/* ============================================================
   Kyle A. Rains — cartographic theme
   A deliberately single, light "survey map" look:
   parchment ground, faint coordinate graticule, teal ink,
   monospace map labels. Edit colors/type in the tokens below.
   ============================================================ */

:root {
  /* palette — aged survey map */
  --paper:      #ECEAE0;   /* parchment ground              */
  --surface:    #F5F3EB;   /* raised panels                 */
  --ink:        #1E2A2A;   /* dark teal-charcoal text       */
  --muted:      #5C625E;   /* secondary text                */
  --line:       #D6D1C0;   /* contour hairlines             */
  --teal:       #1C5D63;   /* primary ink (links, headings) */
  --teal-deep:  #14464B;
  --sea:        #3E7C83;   /* lighter teal (hover)          */
  --brass:      #A9772F;   /* compass / marker accent       */
  --grid:       rgba(28, 93, 99, 0.10);   /* graticule lines */
  --grid-major: rgba(28, 93, 99, 0.18);

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino,
                "Book Antiqua", Georgia, serif;
  --font-sans:  system-ui, -apple-system, "Segoe UI", Roboto,
                Helvetica, Arial, sans-serif;
  --font-mono:  ui-monospace, "Cascadia Code", "Cascadia Mono",
                Consolas, "SFMono-Regular", Menlo, monospace;

  --measure: 66ch;
  --radius: 4px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: light;   /* committed single (map) theme */
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  /* coordinate graticule over parchment */
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1.5px, transparent 1.5px),
    linear-gradient(90deg, var(--grid-major) 1.5px, transparent 1.5px);
  background-size: 46px 46px, 46px 46px, 230px 230px, 230px 230px;
  background-position: -1px -1px;
}

/* map "neatline" frame around the whole page */
body::after {
  content: ""; position: fixed; inset: 9px; pointer-events: none; z-index: 40;
  border: 1px solid color-mix(in srgb, var(--teal) 40%, transparent);
  box-shadow: inset 0 0 0 3px var(--paper),
              inset 0 0 0 4px color-mix(in srgb, var(--teal) 22%, transparent);
}
@media (max-width: 640px) { body::after { inset: 5px; } }

.wrap { width: 100%; max-width: 940px; margin: 0 auto; padding: 0 1.5rem; }

/* ---- map-label helpers ---- */
.coord {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--brass);
  margin: 0 0 0.9rem;
}
.coord::before { content: "◈ "; color: var(--teal); }

/* ---- header / nav ---- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);   /* double neatline */
}
.nav {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 0.4rem 1.25rem; padding: 0.95rem 0 0.85rem;
}
.brand {
  font-family: var(--font-mono);
  font-size: 0.92rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand:hover { color: var(--teal); }
.nav-links { display: flex; flex-wrap: wrap; gap: 0.2rem 1.35rem; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--muted); text-decoration: none; font-size: 0.9rem;
  letter-spacing: 0.02em; padding-bottom: 2px;
  border-bottom: 1.5px solid transparent; transition: color .15s, border-color .15s;
}
.nav-links a:hover { color: var(--ink); border-bottom-color: var(--brass); }

/* ---- sections ---- */
main { padding: 0 0 4rem; }
.section { padding: 3.4rem 0; border-top: 1px dashed color-mix(in srgb, var(--teal) 30%, var(--line)); }
.section:first-of-type { border-top: none; }

h1, h2, h3 { font-family: var(--font-serif); color: var(--ink); font-weight: 600; line-height: 1.14; text-wrap: balance; }
h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); margin: 0 0 0.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.65rem; margin: 0 0 1.2rem; }
h3 { font-size: 1.12rem; margin: 1.6rem 0 0.3rem; }

p { max-width: var(--measure); margin: 0 0 1.05rem; }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--sea); }
.lead { font-size: 1.24rem; line-height: 1.55; color: var(--ink); max-width: var(--measure); }

/* ---- hero ---- */
.hero { padding: 3rem 0 2rem; }
.hero-intro {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "media" "text";
  gap: 1.6rem;
  align-items: start;
}
.hero-text { grid-area: text; }
@media (min-width: 760px) {
  .hero-intro {
    grid-template-columns: 1fr 250px;
    grid-template-areas: "text media";
    column-gap: 3rem;
    align-items: center;
  }
}
.hero .role {
  font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.06em;
  color: var(--muted); margin: 0 0 1.4rem;
}
.hero .role strong { color: var(--teal); font-weight: 600; }
.fields {
  display: inline-flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.6rem 0 0;
  padding: 0; list-style: none;
}
.fields li {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--teal-deep);
  border: 1px solid color-mix(in srgb, var(--teal) 35%, var(--line));
  border-radius: 100px; padding: 0.22rem 0.7rem; background: var(--surface);
}

/* framed portrait (map inset) */
.hero-media { grid-area: media; justify-self: start; width: 100%; max-width: 200px; }
@media (min-width: 760px) { .hero-media { justify-self: end; align-self: center; max-width: 250px; } }
.portrait-frame { position: relative; }
.portrait-frame img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; border: 1px solid var(--teal); }
.portrait-frame::after { content: ""; position: absolute; inset: 5px; border: 1px solid color-mix(in srgb, var(--teal) 45%, transparent); pointer-events: none; }
.portrait-cap { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-align: center; margin: 0.5rem 0 0; }

/* the real map — a faded strip across the top of every page */
.masthead {
  height: 172px;
  background:
    linear-gradient(color-mix(in srgb, var(--teal) 10%, transparent), color-mix(in srgb, var(--teal) 10%, transparent)),
    linear-gradient(to bottom, transparent 0%, color-mix(in srgb, var(--paper) 45%, transparent) 55%, var(--paper) 100%),
    var(--masthead-img, url("/map.jpg")) center 32% / cover no-repeat;
  border-bottom: 1px solid color-mix(in srgb, var(--teal) 50%, var(--line));
}
@media (max-width: 640px) { .masthead { height: 108px; } }

.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.8rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.58rem 1.1rem; border-radius: var(--radius); font-size: 0.95rem;
  text-decoration: none; border: 1px solid var(--teal); transition: background .15s, color .15s;
}
.btn-primary { background: var(--teal); color: var(--surface); }
.btn-primary:hover { background: var(--teal-deep); color: var(--surface); }
.btn-ghost { color: var(--teal); background: transparent; }
.btn-ghost:hover { background: color-mix(in srgb, var(--teal) 10%, transparent); color: var(--teal-deep); }

/* ---- research / publication entries ---- */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub { padding: 1.15rem 0; border-top: 1px dotted var(--line); }
.pub:first-child { border-top: none; }
.pub-title { font-family: var(--font-serif); font-size: 1.1rem; margin: 0 0 0.3rem; color: var(--ink); }
.pub-meta { color: var(--muted); font-size: 0.92rem; margin: 0; }
.pub-meta em { color: var(--teal-deep); font-style: italic; }
.tag {
  display: inline-block; font-family: var(--font-mono);
  font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brass); border: 1px solid color-mix(in srgb, var(--brass) 40%, var(--line));
  border-radius: 100px; padding: 0.08rem 0.55rem; margin-left: 0.5rem; vertical-align: 0.12em;
}

.subhead {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.74rem; color: var(--teal-deep); margin: 2rem 0 0.4rem; font-weight: 600;
}
.subhead:first-of-type { margin-top: 0.5rem; }

/* ---- CV rows ---- */
.cv-row {
  display: grid; grid-template-columns: 1fr; gap: 0.1rem 1.5rem;
  padding: 0.8rem 0; border-top: 1px dotted var(--line);
}
.cv-row:first-of-type { border-top: none; }
@media (min-width: 620px) { .cv-row { grid-template-columns: 1fr 11rem; } }
.cv-detail strong { font-weight: 600; }
.cv-detail span { color: var(--muted); display: block; font-size: 0.95rem; }
.cv-date {
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
@media (min-width: 620px) { .cv-date { text-align: right; } }
.skills { font-family: var(--font-mono); font-size: 0.92rem; color: var(--ink); }

/* ---- contact ---- */
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 1rem 2rem; margin-top: 1.4rem; }
@media (min-width: 560px) { .contact-grid { grid-template-columns: repeat(2, 1fr); } }
.contact-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; background: var(--surface); }
.contact-card .label {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 0.68rem; color: var(--muted); margin: 0 0 0.3rem;
}
.contact-card a, .contact-card p { margin: 0; word-break: break-word; }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--line); color: var(--muted);
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em;
  padding: 1.8rem 0 3rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 0.9rem 1.5rem; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--teal); }

/* map scale bar + compass motif */
.scalebar { display: flex; flex-direction: column; gap: 3px; }
.scalebar .bar { display: flex; width: 150px; height: 6px; border: 1px solid var(--muted); }
.scalebar .bar span { flex: 1; }
.scalebar .bar span:nth-child(odd) { background: var(--muted); }
.scalebar .ticks { display: flex; justify-content: space-between; width: 150px; font-size: 0.58rem; letter-spacing: 0.04em; }
.rose { width: 40px; height: 40px; color: var(--teal); opacity: 0.85; flex: none; }

/* ---- accessibility ---- */
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
