:root {
  --paper:  #FBFBF9;
  --band:   #E7FEF6;
  --ink:    #16293A;
  --dim:    #54626A;
  --rule:   #DEE2DC;
  --hl:     #FBEFC9;
  --bar:    #F2C6AC;
  --accent: #1F5E7A;

  --work-bg: #DCE8F0;  --work-fg: #1D3F55;
  --edu-bg:  #F6E1D6;  --edu-fg:  #6E3F2E;
  --tea-bg:  #E1EBD8;  --tea-fg:  #3C4E2B;
  --awd-bg:  #F7E9C4;  --awd-fg:  #5C4A15;
  --loc-bg:  #E8E9E4;  --loc-fg:  #4B5147;

  --serif: "Iowan Old Style", Charter, "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:  #101418;
    --band:   #161E1C;
    --ink:    #E7EAE6;
    --dim:    #93A0A5;
    --rule:   #252B2E;
    --hl:     #3A3620;
    --bar:    #4A3628;
    --accent: #7FB8CE;

    --work-bg: #1E2E39;  --work-fg: #AECBDD;
    --edu-bg:  #38271F;  --edu-fg:  #E3C0AF;
    --tea-bg:  #28331F;  --tea-fg:  #C5D5AB;
    --awd-bg:  #37301A;  --awd-fg:  #DECB8E;
    --loc-bg:  #262A26;  --loc-fg:  #B9BFB6;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

.wrap {
  max-width: calc(34rem + 48px);   /* 34rem measure, ~64 characters */
  margin: 0 auto;
  padding-inline: 24px;
}

/* ---- hero band ---- */

.hero {
  background: var(--band);
  padding: 4.4rem 0 3.1rem;
  margin-bottom: 3.6rem;
}

.hero-inner {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 2.2rem;
}

.intro { min-width: 0; }

/* an apricot block sits offset behind the photo, echoing the bar on the name */
.portrait {
  position: relative;
  flex: 0 0 auto;
  width: 176px;
  height: 176px;
  margin: 0;
}

.portrait img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 12px;
  width: 100%;
  height: 100%;
  background: var(--bar);
}

@media (min-width: 640px) {
  .hero-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 2.6rem;
  }
}

.name {
  font-size: clamp(1.75rem, 6.2vw, 2.375rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
}

/* the bar rides behind the letterforms, overhanging the text slightly */
.name span {
  background-image: linear-gradient(var(--bar), var(--bar));
  background-repeat: no-repeat;
  background-size: 100% 0.25em;
  background-position: 0 66%;
  padding: 0 0.13em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.email {
  font-family: var(--mono);
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  margin: 2rem 0 0;
}

.icons {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 20px;
  row-gap: 12px;
  margin: 1.05rem 0 0;
  padding: 0;
}

.icons a {
  display: block;
  background: none;
  padding: 0;
  margin: 0;
  text-decoration: none;
  color: var(--ink);
}
.icons a:hover { color: var(--accent); }

.icons svg { display: block; fill: currentColor; }
.icons a:focus-visible { outline-offset: 5px; }

/* ---- links and marks ---- */

a {
  color: inherit;
  background: var(--hl);
  padding: 0.12em 0.12em;
  margin: 0 -0.12em;
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
a:hover { color: var(--accent); }

.hl {
  background: var(--hl);
  padding: 0.12em 0.12em;
  margin: 0 -0.12em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---- body ---- */

main { padding-bottom: 7rem; }

p { margin: 0 0 1.4em; text-wrap: pretty; }

hr {
  border: 0;
  width: 72px;
  height: 4px;
  background: var(--bar);
  margin: 4em 0 2.4em;
}

.cv { list-style: none; margin: 0; padding: 0; }

.cv li {
  display: grid;
  grid-template-columns: 5.6em 1fr;
  align-items: baseline;
  column-gap: 14px;
  margin-bottom: 1.15em;
}
.cv li:last-child { margin-bottom: 0; }

.cat {
  justify-self: start;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
  padding: 3px 7px;
  border-radius: 2px;
  background: var(--work-bg);
  color: var(--work-fg);
}
.cat--edu { background: var(--edu-bg); color: var(--edu-fg); }
.cat--tea { background: var(--tea-bg); color: var(--tea-fg); }
.cat--awd { background: var(--awd-bg); color: var(--awd-fg); }
.cat--loc { background: var(--loc-bg); color: var(--loc-fg); }

/* ---- writing post template ---- */

.post-page { padding-top: 4rem; }

.back { display: inline-block; font-size: 0.9375rem; margin: 0 0 2.6em; }

.post-title {
  font-size: clamp(1.5rem, 5vw, 1.875rem);
  line-height: 1.24;
  letter-spacing: -0.018em;
  font-weight: 600;
  margin: 0 0 0.4em;
  text-wrap: balance;
}

.date {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--dim);
  margin: 0 0 2.4em;
}

.post h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.68;
  margin: 2em 0 0.6em;
}

.post ul, .post ol { padding-left: 1.2em; margin: 0 0 1.4em; }
.post li { margin-bottom: 0.35em; }

blockquote {
  margin: 0 0 1.4em;
  padding-left: 18px;
  border-left: 1px solid var(--rule);
  color: var(--dim);
}

@media (max-width: 600px) {
  .wrap { padding-inline: 20px; }
  .hero { padding: 3.4rem 0 2.6rem; margin-bottom: 2.6rem; }
  main { padding-bottom: 4.5rem; }
  .cv li { grid-template-columns: 5.4em 1fr; column-gap: 12px; }
  .portrait { width: 132px; height: 132px; }
}

@media (max-width: 359px) {
  /* Georgia (Windows fallback) sets wider than Iowan; keep the name on one line */
  .name { font-size: 1.5rem; }

  .cv li {
    grid-template-columns: 1fr;
    row-gap: 5px;
    margin-bottom: 1.3em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

em { font-style: italic; }
