/* Academic portfolio: existing navy palette, clear hierarchy, responsive layout. */
:root {
  --brand: #173f62;
  --brand-strong: #0d2542;
  --brand-soft: #e6edf2;
  --brand-softer: #f4f6f7;
  --ink: #233342;
  --ink-muted: #586977;
  --border: #d7e0e6;
  --surface: #f2f5f7;
  --bg: #fff;
  --page-max: 72rem;
  --page-pad: clamp(1.25rem, 4vw, 2.5rem);
  --header-height: 6.5rem;
  --radius: 12px;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Work Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 1rem); }
body { margin: 0; font-family: var(--font-sans); background: var(--bg); color: var(--ink); line-height: 1.65; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); text-underline-offset: .2em; }
:where(a, button, summary):focus-visible { outline: 3px solid #a76218; outline-offset: 4px; }
[hidden] { display: none !important; }
.container { width: 100%; max-width: var(--page-max); padding-inline: var(--page-pad); margin-inline: auto; }
.skip-link { position: fixed; top: .5rem; left: -9999px; z-index: 100; padding: .7rem 1rem; background: #fff; color: var(--brand-strong); border-radius: 6px; }
.skip-link:focus { left: .5rem; }

/* Two compact rows on small screens; one on desktop. */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--border); }
.header-inner { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .25rem 1rem; align-items: center; padding-block: .6rem .3rem; }
.brand { color: var(--brand-strong); font-family: var(--font-display); font-size: .98rem; font-weight: 600; line-height: 1.2; text-decoration: none; }
.site-nav { grid-column: 1 / -1; grid-row: 2; }
.site-nav ul { display: flex; gap: 1.5rem; }
.site-nav a { display: inline-flex; align-items: center; min-height: 40px; font-size: .88rem; color: var(--ink-muted); text-decoration: none; font-weight: 500; }
.site-nav a:hover { color: var(--brand-strong); text-decoration: underline; }
.lang-switch { display: flex; gap: 1px; padding: 2px; border: 1px solid var(--border); border-radius: 999px; }
.lang-btn { min-width: 33px; min-height: 36px; padding: .2rem .35rem; border: 0; border-radius: 999px; background: transparent; color: var(--ink-muted); font: 600 .7rem var(--font-sans); cursor: pointer; }
.lang-btn:hover { background: var(--surface); color: var(--brand-strong); }
.lang-btn.is-active { background: var(--brand-strong); color: #fff; }

/* Introduction. The portrait is the original image from the site. */
.hero { background: var(--brand-strong); color: #fff; padding-block: 2.25rem 2.75rem; }
.hero-inner { display: grid; gap: 1.4rem; }
.photo-frame { grid-row: 1; width: 6.5rem; height: 7.25rem; border-radius: 10px; overflow: hidden; background: var(--brand-soft); border: 1px solid rgba(255,255,255,.45); }
.photo-frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.eyebrow { display: block; color: #c7d9e6; text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 600; }
.name { max-width: 12ch; margin-top: .7rem; font: 500 clamp(2.5rem, 7vw, 4.6rem)/1.06 var(--font-display); letter-spacing: -.035em; text-wrap: balance; }
.summary { max-width: 38rem; margin-top: 1.3rem; font-size: 1.03rem; line-height: 1.7; color: #e0e9f0; }
.hero-affiliation { margin-top: 1.35rem; padding-left: 1rem; border-left: 2px solid #6587a0; }
.institution { max-width: 36rem; font-size: .88rem; color: #eff3f6; }
.graduation { margin-top: .15rem; color: #bacbd9; font-size: .82rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.7rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .85rem; min-height: 48px; padding: .7rem 1.1rem; border: 1px solid transparent; border-radius: 6px; font-size: .88rem; font-weight: 600; line-height: 1.4; text-decoration: none; transition: background-color .18s, border-color .18s; }
.button-primary { color: var(--brand-strong); background: #f4f7f9; }
.button-primary:hover { background: #dce8ef; }
.button-primary span[aria-hidden] { font-size: 1.3rem; line-height: 1; }
.button-secondary { color: #fff; border-color: #658098; }
.button-secondary:hover { background: #173754; border-color: #c7d9e6; }
.hero :where(a, button):focus-visible { outline-color: #f2d19f; }

/* Sections and reusable collection cards continue to grow from the admin. */
.section { padding-block: clamp(2.75rem, 6vw, 4.75rem); }
.section-alt { background: var(--surface); }
.section-heading { display: flex; gap: 1rem; align-items: center; }
.section-number { color: #6d8293; font-size: .72rem; font-weight: 600; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.section-title { color: var(--brand-strong); font: 500 clamp(1.8rem, 4vw, 2.5rem)/1.2 var(--font-display); letter-spacing: -.025em; text-wrap: balance; }
.section-lead { max-width: 42rem; color: var(--ink-muted); margin-top: .9rem; }
.sub-title { font: 500 1.35rem/1.3 var(--font-display); color: var(--brand-strong); margin-top: 2.25rem; }
.sub-lead { color: var(--ink-muted); margin-top: .6rem; max-width: 42rem; }
.project-grid { display: grid; gap: 1.5rem; margin-top: 2rem; }
.project-card { padding: clamp(1.35rem, 4vw, 2.5rem); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.project-period { display: inline-block; color: var(--brand); font-size: .78rem; font-weight: 600; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.project-title { max-width: 34ch; margin-top: .6rem; color: var(--brand-strong); font: 500 clamp(1.35rem, 3vw, 2rem)/1.25 var(--font-display); letter-spacing: -.015em; text-wrap: balance; overflow-wrap: break-word; }
.project-subtitle { margin-top: .85rem; font-size: .92rem; color: var(--ink-muted); }
.project-desc { max-width: 65ch; margin-top: 1rem; color: var(--ink); }
.project-details { margin-top: 1.2rem; max-width: 65ch; }
.project-details summary { width: fit-content; padding-block: .5rem; color: var(--brand); font-size: .85rem; font-weight: 500; cursor: pointer; }
.project-details summary:hover { text-decoration: underline; }
.project-full-title { padding: .8rem 1rem; border-left: 2px solid var(--border); background: var(--surface); color: var(--ink-muted); font-size: .9rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.3rem; }
.tag { padding: .35rem .7rem; border-radius: 4px; background: var(--brand-soft); color: var(--brand-strong); font-size: .74rem; font-weight: 500; overflow-wrap: anywhere; }
.project-link-row { margin-top: 1.25rem; }
.project-link { display: inline-flex; min-height: 44px; align-items: center; font-size: .9rem; font-weight: 600; }

/* Education and languages share a quiet, readable layout. */
.education-layout { display: grid; gap: 2rem; margin-top: 2rem; }
.education-list { display: grid; gap: 1.5rem; align-content: start; }
.education-item { padding: .25rem 0 .25rem 1.25rem; border-left: 2px solid #afc2d1; }
.education-degree { margin-top: .5rem; font: 500 1.35rem/1.3 var(--font-display); color: var(--brand-strong); }
.education-item .project-subtitle { margin-top: .65rem; }
.languages-panel { padding: 1.5rem; background: var(--surface); border-radius: var(--radius); }
.languages-panel .sub-title { margin-top: 0; }
.language-list { display: grid; gap: .7rem; margin-top: 1.25rem; }
.language-item { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding-bottom: .7rem; border-bottom: 1px solid var(--border); }
.language-item:last-child { border-bottom: 0; padding-bottom: 0; }
.language-name { font-size: .92rem; font-weight: 500; }
.language-level { color: var(--ink-muted); font-size: .82rem; text-align: right; }

/* Existing contact information, with clear email and phone actions. */
.section-contact { background: #eaf0f4; border-top: 1px solid var(--border); }
.contact-grid { display: grid; gap: .8rem; margin-top: 2rem; }
.contact-card { display: flex; align-items: center; gap: .8rem; height: 100%; padding: 1.05rem 1rem; border: 1px solid #cedbe4; border-radius: 8px; color: inherit; text-decoration: none; background: rgba(255,255,255,.65); transition: background-color .18s, border-color .18s; }
a.contact-card:hover { background: #fff; border-color: var(--brand); }
.contact-icon { display: grid; place-items: center; flex-shrink: 0; width: 2rem; height: 2rem; color: var(--brand); }
.contact-text { display: flex; flex-direction: column; min-width: 0; }
.contact-label { font-size: .66rem; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-muted); }
.contact-value { margin-top: .15rem; font-size: .88rem; font-weight: 500; color: var(--brand-strong); overflow-wrap: anywhere; }
.site-footer { padding-block: 1.4rem; background: var(--brand-strong); color: #c7d6e1; font-size: .78rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem 1.5rem; }

@media (min-width: 40rem) {
  .hero { padding-block: 3.75rem; }
  .hero-inner { grid-template-columns: minmax(0, 1fr) 13rem; gap: 2rem; align-items: center; }
  .photo-frame { grid-column: 2; grid-row: 1; width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 14px; }
  .hero-text { grid-column: 1; grid-row: 1; }
  .name { font-size: clamp(2.7rem, 5.6vw, 4.6rem); }
  .contact-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (min-width: 56rem) {
  .header-inner { grid-template-columns: minmax(0,1fr) auto auto; padding-block: .85rem; gap: 2rem; }
  .brand { font-size: 1.12rem; }
  .site-nav { grid-column: 2; grid-row: 1; }
  .site-nav ul { gap: 1.75rem; }
  .lang-switch { grid-column: 3; }
  .hero { padding-block: 4.25rem 4.75rem; }
  .hero-inner { grid-template-columns: minmax(0,1fr) 14.5rem; gap: 3.5rem; }
  .summary { font-size: 1.1rem; }
  .education-layout { grid-template-columns: minmax(0,1fr) 18rem; gap: 4rem; }
  .contact-grid { grid-template-columns: 1.35fr 1fr 1fr; }
}
@media (max-width: 23rem) {
  .header-inner { column-gap: .65rem; }
  .brand { font-size: .9rem; }
  .lang-btn { min-width: 30px; }
  .site-nav ul { justify-content: space-between; gap: .5rem; }
  .hero-actions { gap: .6rem; }
  .button { padding-inline: .85rem; font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .site-header, .hero-actions, .skip-link { display: none; }
  .hero, .section, .site-footer { background: #fff; color: #000; padding-block: 1.25rem; }
  .hero * { color: #000; }
  .hero-inner { grid-template-columns: minmax(0,1fr) 8rem; gap: 2rem; }
  .photo-frame { grid-column: 2; grid-row: 1; }
  .name { font-size: 2.3rem; }
  .project-card, .education-item { break-inside: avoid; }
}

/* Public tools and printable CV. */
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
input, textarea, select { min-width: 0; max-width: 100%; padding: .7rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
label { display: grid; gap: .4rem; font-size: .88rem; font-weight: 500; }
:where(input, textarea, select):focus-visible { outline: 3px solid #a76218; outline-offset: 2px; }
.lang-btn { display: grid; place-items: center; text-decoration: none; }
.button-solid { background: var(--brand-strong); color: white; }
.button-solid:hover { background: var(--brand); }
.button-outline { border-color: #8ba1b3; color: var(--brand-strong); background: transparent; }
.button-outline:hover { background: var(--brand-soft); }
.tool-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-block: 1.5rem; }
.narrow { max-width: 55rem; }
.page-title { font: 500 clamp(2rem, 4.5vw, 3.7rem)/1.15 var(--font-display); color: var(--brand-strong); text-wrap: balance; overflow-wrap: anywhere; margin-block: .8rem 1.2rem; }
.back-link { display: inline-block; margin-bottom: 2rem; font-size: .9rem; }
.eyebrow.ink { color: var(--brand); }
.project-desc, .cv-summary { white-space: pre-line; }
.contact-composer { margin-top: 2rem; max-width: 49rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.contact-composer summary { cursor: pointer; font-weight: 600; padding-block: .6rem; }
.contact-composer form { display: grid; gap: 1rem; margin-top: 1rem; }
.contact-composer fieldset { padding: 0; border: 0; }
.contact-composer legend { font-size: .86rem; margin-bottom: .7rem; }
.intent-options { display: flex; flex-wrap: wrap; gap: .8rem; }
.intent-options label { display: flex; align-items: center; padding: .6rem .8rem; background: white; border-radius: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hint { font-size: .82rem; line-height: 1.5; color: var(--ink-muted); }
.site-footer a, .site-footer button { color: inherit; }
.site-footer button { background: transparent; border: 1px solid #849daf; border-radius: 4px; }
.site-status { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 70; width: max-content; max-width: calc(100% - 2rem); border-radius: 8px; padding: .8rem 1.2rem; color: #fff; background: var(--brand-strong); box-shadow: 0 4px 20px #0003; }
.preview-strip { background: #fff1db; color: #603b0b; font-size: .78rem; text-align: center; padding: .25rem; }
.digital-card { max-width: 44rem; margin: auto; padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.digital-card img { object-fit: cover; border-radius: 8px; margin-bottom: 1.5rem; }
.digital-card .page-title { font-size: clamp(2rem, 5vw, 3.2rem); }
.card-email { display: block; margin-top: 1.4rem; overflow-wrap: anywhere; }
.cv-top { padding-top: 2.5rem; }
.cv-summary { max-width: 65ch; margin-top: 1.5rem; }
.cv-contact { margin-top: .8rem; overflow-wrap: anywhere; }
.cv-page { max-width: 64rem; margin: auto; }
.cv-page .section { padding-block: 2rem; }
.cv-page .project-title { font-size: 1.25rem; max-width: none; }
.cv-page .project-card { padding: 1.3rem; }
.portfolio-helper { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 50; max-width: calc(100vw - 2.4rem); }
.portfolio-helper > summary { list-style: none; cursor: pointer; border-radius: 99px; background: var(--brand-strong); color: white; border: 1px solid #7d9bb1; padding: .8rem 1.2rem; box-shadow: 0 4px 20px #0002; width: fit-content; margin-left: auto; font-size: .88rem; }
.portfolio-helper > summary::-webkit-details-marker { display: none; }
.helper-panel { width: 24rem; max-width: 100%; max-height: min(70vh, 36rem); overflow: auto; background: white; border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; box-shadow: 0 8px 36px #0d254233; margin-top: .6rem; }
.helper-panel h2 { font: 500 1.4rem var(--font-display); margin-bottom: .6rem; }
.helper-panel form { display: grid; gap: .6rem; margin-block: 1rem; }
.helper-panel article { padding-block: .8rem; border-top: 1px solid var(--border); }
.helper-panel article a { font-weight: 600; }
.helper-panel article p { font-size: .85rem; margin-top: .4rem; }
.helper-links { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .85rem; }
@media(max-width: 40rem) { .form-grid { grid-template-columns: 1fr; } .portfolio-helper { right: .8rem; bottom: .8rem; max-width: calc(100vw - 1.6rem); } .helper-panel { max-height: 60vh; } }
@media print {
  @page { size: A4; margin: 16mm; }
  .no-print, .site-footer, .portfolio-helper, .site-status, .preview-strip { display: none !important; }
  body { font-size: 10pt; line-height: 1.45; }
  .cv-page .container { padding-inline: 0; }
  .cv-top { padding-top: 0; }
  .cv-page .page-title { font-size: 25pt; }
  .cv-page .section { padding-block: 12pt; }
  .cv-page .section-title { font-size: 16pt; }
  .cv-page .education-layout { grid-template-columns: minmax(0, 1fr) 13rem; gap: 1rem; }
  .cv-page .project-grid { margin-top: 12pt; gap: 12pt; }
  .cv-page .project-card { border: 0; padding: 0; }
  .cv-page .project-title { font-size: 12pt; }
  .cv-page .project-desc { margin-top: 6pt; }
  .cv-page .tag-list { margin-top: 6pt; }
  a { color: inherit; }
}

.contact-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
#contact-form button:disabled { opacity: .55; cursor: not-allowed; }
#contact-status { min-height: 1.5em; }
.research-tools,.cv-builder {padding:1.4rem;background:#f2f5f8;border-radius:12px;margin-bottom:1.5rem;display:flex;gap:1rem;flex-wrap:wrap}
.research-tools label {flex:1;min-width:200px}.research-tools input,.research-tools select,.cv-builder select {width:100%;padding:.7rem;border:1px solid #bac7d5;border-radius:6px;background:white;color:#0d2542;font:inherit}
.cv-builder {display:block}.cv-builder select{max-width:400px}.cv-include{display:block;margin-top:1rem}.cv-excluded{opacity:.45}.experience-share{border:0;background:transparent;color:#244969;cursor:pointer;font:inherit;text-decoration:underline;margin-top:.8rem}.event-qr{display:block;margin:1rem auto}.event-research{text-align:left}.contact-grid{grid-template-columns:repeat(2,minmax(0,1fr))}[hidden]{display:none!important}
@media print {.cv-excluded{display:none!important}.event-qr{display:block}.site-header,.site-footer{display:none}}
@media(max-width:600px){.contact-grid{grid-template-columns:1fr}}

/* Visitor theme follows device unless the visitor chooses an override. */
.theme-toggle{grid-column:2;justify-self:end;border:1px solid var(--border);border-radius:20px;background:var(--bg);color:var(--ink);font:500 .75rem var(--font-sans);padding:.5rem .75rem;min-height:40px;cursor:pointer}
@media(min-width:1100px){.header-inner{grid-template-columns:minmax(0,1fr) auto auto auto}.theme-toggle{grid-column:auto}}
@media screen{
html[data-theme="dark"]{color-scheme:dark;--bg:#090b0e;--surface:#151b23;--ink:#f0f3f6;--ink-muted:#b5c0cd;--brand:#9dc6e6;--brand-strong:#b8daf3;--brand-soft:#253343;--brand-softer:#151b23;--border:#35404c}
html[data-theme="dark"] body,html[data-theme="dark"] .section,html[data-theme="dark"] .site-header,html[data-theme="dark"] .site-footer,html[data-theme="dark"] .digital-card{background:#090b0e;color:#f0f3f6}
html[data-theme="dark"] .hero{background:linear-gradient(120deg,#111a25,#182738);color:#f0f3f6}
html[data-theme="dark"] .hero .summary,html[data-theme="dark"] .hero .institution,html[data-theme="dark"] .hero .graduation,html[data-theme="dark"] .hero .eyebrow{color:#d8e4ef}
html[data-theme="dark"] .section-contact,html[data-theme="dark"] .project-card,html[data-theme="dark"] .contact-card,html[data-theme="dark"] .research-tools,html[data-theme="dark"] .cv-builder{background:#151b23;color:#f0f3f6}
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3,html[data-theme="dark"] .section-lead,html[data-theme="dark"] .project-desc,html[data-theme="dark"] .contact-text{color:#f0f3f6}
html[data-theme="dark"] input,html[data-theme="dark"] textarea,html[data-theme="dark"] select,html[data-theme="dark"] .research-tools input,html[data-theme="dark"] .research-tools select,html[data-theme="dark"] .cv-builder select{background:#18212b;color:#f0f3f6;border-color:#506174}
html[data-theme="dark"] a,html[data-theme="dark"] .site-footer a{color:#9dc6e6}
html[data-theme="dark"] .button-solid,html[data-theme="dark"] .button-primary{background:#9dc6e6;color:#101820;border-color:#9dc6e6}
html[data-theme="dark"] .button-secondary,html[data-theme="dark"] .button-outline{color:#d8e8f5;border-color:#7793ad}
html[data-theme="dark"] .tag{background:#253343;color:#d8e8f5}
html[data-theme="dark"] .contact-card:hover{background:#202b38}
}
@media print{.theme-toggle{display:none}}

/* Keep dropdown arrows inset and reserve space for the selected text. */
select,.research-tools select,.cv-builder select{appearance:none;-webkit-appearance:none;padding-right:2.8rem!important;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238394a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")!important;background-repeat:no-repeat!important;background-position:right 1rem center!important;background-size:16px 16px!important}
@media(forced-colors:active){select,.research-tools select,.cv-builder select{appearance:auto!important;-webkit-appearance:auto!important;background-image:none!important}}

.preview-theme-picker{position:relative;width:100%}.preview-theme-trigger{width:100%;text-align:left;padding:.7rem 2.8rem .7rem .7rem;border:1px solid var(--border);border-radius:6px;font:inherit;color:var(--ink);background:var(--bg);cursor:pointer}.preview-theme-trigger::after{content:'⌄';position:absolute;right:1rem;top:.55rem}.preview-theme-options{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:50;background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:.3rem;box-shadow:0 8px 24px #0003;max-height:240px;overflow:auto}.preview-theme-options button{display:block;width:100%;padding:.65rem;text-align:left;color:var(--ink);background:transparent;border:0;font:inherit;cursor:pointer}.preview-theme-options button:hover,.preview-theme-options button:focus-visible{background:var(--brand-soft)}
