/* Shared portfolio theme. System fonts keep the site fast and self-contained. */
:root {
  color-scheme: light;
  --paper: #f7f9fc; --surface: #ffffff; --ink: #172b46;
  --rust: #245b88; --olive: #387462; --mustard: #edf3f9;
  --rule: #dbe3ec; --muted: #526278;
  --bg-dark: var(--paper); --bg-light: var(--surface);
  --text-primary: var(--ink); --text-secondary: var(--muted); --accent-blue: var(--rust);
  --display: "Segoe UI", Arial, sans-serif;
  --body: "Segoe UI", Arial, sans-serif;
  --mono: "Segoe UI", Arial, sans-serif;
  --snap: 160ms ease;
}
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { background: var(--paper); scroll-behavior: smooth; scroll-padding-top: 28px; -webkit-text-size-adjust: 100%; }
body { max-width: 1240px; margin: auto; padding: 0 48px; color: var(--ink); font: 16px/1.75 var(--body); }
::selection { background: #d5e6f5; color: var(--ink); }
a { color: inherit; text-underline-offset: .2em; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--rust); outline-offset: 5px; }
img, svg { max-width: 100%; }
ul { list-style: none; }
body > header { position: relative; z-index: 10; min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--rule); }
.logo a { display: inline-block; font: 650 21px/1.3 var(--display); letter-spacing: -.035em; text-decoration: none; }
nav ul { display: flex; align-items: center; gap: 28px; }
nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; transition: color var(--snap); }
nav a:hover { color: var(--rust); }
.hamburger { display: none; width: 44px; height: 44px; padding: 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: 5px; cursor: pointer; }
.hamburger .bar { display: block; height: 2px; width: 20px; margin: 4px auto; background: var(--ink); transition: transform var(--snap); }
section { min-width: 0; scroll-margin-top: 32px; }
.hero { padding: 100px 0 88px; max-width: 900px; }
.hero-kicker { margin-bottom: 18px; color: var(--rust); font-size: 13px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }
.hero h1 { font: 650 clamp(44px, 6vw, 76px)/1.1 var(--display); letter-spacing: -.055em; }
.hero h2 { margin-top: 22px; max-width: 35ch; color: var(--muted); font: 400 clamp(22px, 3vw, 30px)/1.45 var(--display); letter-spacing: -.025em; }
.hero-summary { max-width: 66ch; margin-top: 22px; color: var(--muted); font-size: 17px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.cta-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 46px; padding: 11px 22px; border: 1px solid var(--rust); border-radius: 5px; background: var(--rust); color: #fff; font: 600 14px/1.5 var(--body); text-decoration: none; cursor: pointer; transition: background var(--snap), border-color var(--snap); }
.cta-button:hover { background: #194567; border-color: #194567; }
.cta-button.secondary { color: var(--ink); border-color: var(--rule); background: var(--surface); }
.cta-button.secondary:hover { background: var(--mustard); border-color: #acbfd3; }
.section-title { font: 650 28px/1.3 var(--display); letter-spacing: -.035em; }
.portfolio-page #who-i-am { display: grid; grid-template-columns: 1fr 2fr; gap: 64px; padding: 54px 0 64px; border-top: 1px solid var(--rule); }
.portfolio-page #who-i-am p { max-width: 66ch; color: var(--muted); }
.portfolio-page #who-i-am p + p { margin-top: 24px; color: var(--ink); font-size: 14px; font-weight: 600; }
.portfolio-page #who-i-am ul { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.portfolio-page #who-i-am li { padding: 4px 12px; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface); font-size: 13px; }
.portfolio-page #projects { padding: 58px 0 80px; border-top: 1px solid var(--rule); }
#projects > .section-title { margin-bottom: 30px; }
.projects-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: stretch; }
.projects-grid > * { min-width: 0; }
.projects-grid > a { display: flex; color: inherit; text-decoration: none; border-radius: 7px; }
.project-card { display: flex; flex-direction: column; position: relative; width: 100%; min-width: 0; padding: 30px; background: var(--surface); border: 1px solid var(--rule); border-radius: 7px; }
.project-card h3 { max-width: 44ch; margin-bottom: 18px; font: 600 22px/1.4 var(--display); letter-spacing: -.025em; overflow-wrap: anywhere; }
.project-card p { color: var(--muted); font-size: 15px; line-height: 1.8; margin-bottom: 26px; }
.tech-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 20px; border-top: 1px solid #eaf0f6; }
.tech-tags span { padding: 3px 9px; border-radius: 4px; color: var(--rust); background: var(--mustard); font-size: 12px; font-weight: 600; }
.projects-grid > a .project-card { transition: border-color var(--snap), box-shadow var(--snap); }
.projects-grid > a .project-card h3 { padding-right: 20px; }
.projects-grid > a .project-card::after { content: "\2197"; position: absolute; top: 30px; right: 24px; color: var(--rust); font-size: 20px; line-height: 1.5; }
.projects-grid > a:hover .project-card, .projects-grid > a:focus-visible .project-card { border-color: #91adc8; box-shadow: 0 6px 22px #172b4608; }
.projects-grid > a:hover h3 { color: var(--rust); }
.portfolio-page #contacts { padding: 48px; margin: 0 0 64px; background: #edf3f9; border: 1px solid var(--rule); border-radius: 7px; }
#contacts .section-title { margin-bottom: 18px; }
#contacts p { max-width: 67ch; color: var(--muted); margin-bottom: 26px; }
body > footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 24px 0 32px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 13px; }
/* Account pages share the typography, palette and form controls. */
.account-page { min-height: 100svh; display: flex; flex-direction: column; }
.account-page main { flex: 1; padding: 75px 0 110px; }
.login-page main { display: grid; place-items: center; }
.login-page #projects { width: min(100%, 460px); padding: 36px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 12px 36px #172b4608; }
.login-page .section-title { font: 650 32px/1.2 var(--display); letter-spacing: -.035em; margin-bottom: 14px; }
.form-intro { font: 400 15px/1.7 var(--body); color: var(--muted); margin-bottom: 28px; }
.form-field { margin-bottom: 22px; }
.form-field label { display: block; margin-bottom: 8px; font: 600 14px/1.5 var(--body); }
input[type="text"], input[type="password"], input[type="email"] { display: block; width: 100%; min-width: 0; min-height: 46px; margin-top: 6px; border: 1px solid #a8b8ca; border-radius: 5px; padding: 10px 12px; background: var(--surface); color: var(--ink); font: 16px/1.5 var(--body); }
input::placeholder { color: var(--muted); }
input:focus { border-color: var(--rust); }
input[readonly] { background: var(--paper); color: var(--muted); }
button:disabled, input[type="submit"]:disabled { opacity: .65; cursor: wait; }
.login-page input[type="submit"] { margin-top: 6px; width: 100%; }
.documents-page #who-i-am { max-width: 840px; margin-inline: auto; }
.documents-page .section-title { font: 650 clamp(28px, 4vw, 38px)/1.25 var(--display); letter-spacing: -.035em; margin-bottom: 16px; overflow-wrap: anywhere; }
.documents-page #who-i-am p { color: var(--muted); margin-bottom: 30px; }
.documents-page #who-i-am li { padding: 20px 24px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); overflow-wrap: anywhere; }
.documents-page #who-i-am li + li { margin-top: 12px; }
.documents-page #who-i-am li a { display: flex; align-items: baseline; justify-content: space-between; gap: 22px; text-decoration: none; font: 500 18px/1.5 var(--body); }
.documents-page #who-i-am li a::after { content: "\2197"; flex: 0 0 auto; color: var(--rust); }
.documents-page #who-i-am li a:hover { color: var(--rust); text-decoration: underline; }
.admin-title-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.admin-title-bar .cta-button::after { content: none; }
.admin-page h1 { font: 650 clamp(28px, 4vw, 38px)/1.25 var(--display); letter-spacing: -.035em; }
.admin-page h2 { margin-bottom: 18px; font: 600 22px/1.35 var(--display); letter-spacing: -.02em; }
.admin-layout { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); }
.admin-layout aside a { display: block; padding: 9px 12px; border-radius: 5px; text-decoration: none; overflow-wrap: anywhere; }
.admin-layout aside a:hover, .admin-layout a[aria-current="page"] { background: var(--mustard); }
.admin-layout a[aria-current="page"] { color: var(--rust); font-weight: bold; }
.admin-editor { min-width: 0; width: 100%; max-width: 740px; }
.admin-editor > section, section.admin-editor { padding: 28px; border: 1px solid var(--rule); border-radius: 7px; background: var(--surface); }
.admin-editor section + section { margin-top: 24px; }
.admin-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.admin-password { grid-column: 1 / -1; }
.admin-editor label { display: block; min-width: 0; font: 600 14px/1.6 var(--body); }
.admin-editor label span, .admin-note { color: var(--muted); font-weight: normal; }
.admin-note { margin: 12px 0 16px; font-size: 14px; }
.admin-documents li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.admin-document-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; overflow-wrap: anywhere; }
.admin-remove { min-height: 44px; padding: 8px 12px; border: 1px solid #dbb4b8; border-radius: 5px; background: #fff7f7; color: #9c303b; font: 600 13px var(--body); cursor: pointer; }
.admin-remove:hover { background: #fce9eb; }
.admin-document-row > a, .admin-document-row > span { min-width: 0; }
.admin-document-row form { flex: 0 0 auto; }
.admin-upload input[type="file"]::file-selector-button { margin-right: 12px; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.admin-upload { display: grid; justify-items: start; gap: 16px; margin-top: 24px; }
.admin-upload label { width: 100%; }
.admin-upload input[type="file"] { display: block; max-width: 100%; margin-top: 8px; }
.admin-notice { margin-bottom: 24px; padding: 12px 16px; border-left: 3px solid var(--olive); border-radius: 4px; background: #edf7f2; }
.admin-notice[role="alert"] { color: #9c303b; border-left-color: #9c303b; background: #fff0f1; }
.letters-page main { width: min(100%, 760px); margin-inline: auto; }
.letters-intro { margin-bottom: 42px; }
.letters-kicker { color: var(--rust); font: bold 12px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.letters-intro h1 { margin: 10px 0 16px; font: 650 clamp(34px, 6vw, 48px)/1.15 var(--display); letter-spacing: -.04em; }
.letters-intro > p:not(.letters-kicker) { margin-bottom: 12px; font: 20px/1.5 var(--display); }
.letters-page h2 { margin-bottom: 6px; font: 600 clamp(23px, 4vw, 28px)/1.3 var(--display); }
.letters-incoming { border-radius: 5px; margin-bottom: 32px; padding: 16px clamp(20px, 5vw, 42px); border-left: 3px solid var(--rust); background: var(--surface); }
.letters-incoming .letters-note { margin-bottom: 10px; }
.letters-incoming li + li { margin-top: 4px; }
.letters-paper { border-radius: 7px; padding: clamp(20px, 5vw, 42px); background: var(--surface); border: 1px solid var(--rule); box-shadow: 0 6px 24px #172b4608; }
.letters-note { margin-bottom: 20px; color: var(--muted); font-size: 14px; }
.letters-form label span, .letters-form .form-field p { color: var(--muted); font-weight: normal; font-size: 13px; }
.letters-form textarea, .letters-form input[type="datetime-local"] { max-width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 5px; background: var(--surface); color: var(--ink); font: 16px/1.6 var(--body); }
.letters-form textarea { display: block; width: 100%; min-height: 150px; resize: vertical; }
.letters-form textarea:focus-visible { outline: 3px solid var(--rust); outline-offset: 3px; }
.letters-form input[type="datetime-local"] { min-height: 44px; }
.letters-form .form-field p { margin-top: 8px; }
.letters-error { margin-bottom: 18px; padding-left: 12px; border-left: 3px solid var(--rust); }
.letters-archive { margin-top: 60px; }
.letter-card { border-top: 1px solid var(--rule); overflow-wrap: anywhere; }
.letter-card summary { padding: 14px 0; cursor: pointer; }
.letter-card summary::marker { color: var(--rust); }
.letter-subject { font: 600 19px/1.4 var(--display); }
.letter-meta { display: block; margin-left: 20px; color: var(--muted); font: 12px/1.5 var(--mono); }
.letter-body { margin: 0 0 20px 20px; white-space: pre-wrap; font: 18px/1.8 Georgia, serif; }
.letters-pagination { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 18px; font-size: 14px; }

@media (max-width: 800px) {
  body { padding-inline: 28px; }
  .hero { padding: 72px 0 64px; }
  .portfolio-page #who-i-am { grid-template-columns: 1fr; gap: 24px; }
  .project-card { padding: 24px; }
  .project-card h3 { font-size: 20px; }
  .projects-grid > a .project-card::after { top: 24px; right: 18px; }
  .portfolio-page #contacts { padding: 32px; }
  .login-page main { padding-left: 0; }
}
@media (max-width: 640px) {
  body { padding-inline: 20px; }
  body > header { min-height: 78px; }
  .hamburger { display: block; }
  nav { display: none; position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px; padding: 12px 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 8px 28px #172b4612; }
  nav.active { display: block; }
  nav ul { flex-direction: column; align-items: stretch; gap: 4px; }
  nav a { width: 100%; }
  .hamburger.active .bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .hamburger.active .bar:nth-child(2) { opacity: 0; }
  .hamburger.active .bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .hero { padding: 56px 0; }
  .hero-kicker { font-size: 11px; letter-spacing: .09em; }
  .hero-summary { font-size: 16px; }
  .portfolio-page #who-i-am { padding: 40px 0; }
  .portfolio-page #projects { padding: 40px 0 48px; }
  .projects-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .portfolio-page #contacts { padding: 26px 22px; margin-bottom: 40px; }
  .section-title { font-size: 25px; }
  .account-page main { padding: 45px 0 64px; }
  .login-page #projects { width: 100%; padding: 28px 22px; }
  .login-page .section-title { font-size: 30px; }
  .documents-page #who-i-am { margin-left: 0; }
  .documents-page .section-title, .admin-page h1 { font-size: 34px; }
  .documents-page #who-i-am li a { font-size: 17px; }
  .documents-page #who-i-am li { padding: 18px; }
  .admin-editor > section, section.admin-editor { padding: 22px 18px; }
  .admin-document-row { flex-wrap: wrap; gap: 10px; }
  .admin-title-bar { flex-direction: column; align-items: flex-start; }
  .admin-layout, .admin-fields { grid-template-columns: minmax(0, 1fr); }
  .admin-layout aside ul { display: flex; flex-wrap: wrap; gap: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@page { margin: 18mm; }
@media print {
  html, body { color: #000; background: #fff; }
  body { padding: 0; }
  nav, .hamburger, .hero-actions { display: none; }
  .hero { padding: 28px 0; }
  .hero h1 { font-size: 36pt; }
  .portfolio-page #who-i-am { display: block; padding: 24px 0; }
  .portfolio-page #who-i-am .section-title { margin-bottom: 16px; }
  .projects-grid { display: block; }
  .projects-grid > * { display: block; margin-bottom: 16px; }
  .project-card { break-inside: avoid; box-shadow: none; }
  .project-card p, #contacts p { color: #333; }
  .portfolio-page #contacts { padding: 24px; background: transparent; margin-bottom: 24px; }
  .cta-button { color: #000; background: transparent; }
  .account-page { min-height: 0; }
}
