/* ==========================================================================
   thomashayama.com — shared paper/ink palette and the plain content pages.
   This is Standard mode. Other modes add their own styles after it
   (/modes/modes.js; Map mode: /modes/map/*.css).
   ========================================================================== */

:root {
  --paper: #eee5c5;
  --paper-dark: #ddcfaa;
  --ink: #29271f;
  --ink-soft: #4c4635;
  --rule: #bcb08f;
  --red: #a93e2c;
  --red-dark: #8b3025;
  --yellow: #e4ba44;
  --teal: #92b7bd;
  --shadow: rgba(42, 26, 15, 0.35);

  --page: 60rem;       /* content column, aligned with the nav rule */
  --measure: 40rem;    /* reading width */
  --gutter: 1.5rem;

  --font-display: 'Lilita One', 'Arial Black', sans-serif;
  --font-body: 'Averia Serif Libre', 'Georgia', serif;
}

/* Base ------------------------------------------------------------------ */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--red-dark); }

/* Modes (/modes/modes.js) --------------------------------------------------
   While a mode starts, its cover colour hides the standard page (no flash);
   the mode lifts it with SiteModes.ready(). A mode that takes a page over
   shows only what it adds (marked data-mode-ui). The standard content stays
   in the DOM for the mode to read, hidden from the first paint so its lazy
   photos never download. */
html.mode-cover { background: var(--mode-cover, var(--paper)); }
html.mode-cover body { visibility: hidden; }
html.mode-takeover body > :not([data-mode-ui]) { display: none !important; }

/* The footer's "View: Standard · Map" switch (rendered by modes.js). */
.mode-switch a[aria-current] { color: var(--ink); font-weight: 700; text-decoration: none; }

/* Keep the footer at the bottom of short pages (and of Standard view). */
body:not(.game), #classic { display: flex; flex-direction: column; min-height: 100dvh; }
body:not(.game) > main, #classic > main { flex: 1 0 auto; }

/* Page shell -------------------------------------------------------------
   Every content page shares one column and one left edge, aligned with the
   navigation rule. Text keeps a reading measure; galleries use the full width. */
nav, main, footer {
  width: min(var(--page), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* Navigation ------------------------------------------------------------- */
/* Two groups: the site's own pages, then the projects. */
nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-body);
  font-size: 1rem;
}

.nav-group { display: flex; flex-wrap: wrap; justify-content: center; }
.nav-group + .nav-group::before {
  content: '';
  align-self: center;
  width: 1px;
  height: 1.1em;
  margin: 0 .5rem;
  background: var(--rule);
}

nav a {
  color: var(--ink);
  padding: .55rem .8rem;
  text-decoration: none;
  text-underline-offset: .3em;
  text-decoration-thickness: 1px;
}

nav a:hover,
nav a:focus-visible,
nav a.active {
  color: var(--red-dark);
  text-decoration: underline;
}
nav a.active { text-decoration-thickness: 2px; }
nav a:focus-visible { outline: 2px solid var(--red-dark); outline-offset: -2px; }

nav a.nav-map { color: var(--red); }
/* The map needs JavaScript (modes.js adds .script). */
html:not(.script) nav a.nav-map,
html:not(.script) .needs-js { display: none; }

/* Main ------------------------------------------------------------------- */
main { padding: 2.5rem 0 4rem; }

h1, h2, h3 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  text-wrap: balance;
}

main h1 {
  font-size: clamp(2.1rem, 5vw, 3rem);
  letter-spacing: -.01em;
  margin: 0 0 1rem;
}

main h2 {
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  margin: 3rem 0 .5rem;
}

main p {
  font-size: 1.1rem;
  margin: 0 0 1.25rem;
  color: var(--ink-soft);
  max-width: var(--measure);
  text-wrap: pretty;
}

main a { text-underline-offset: .18em; text-decoration-thickness: 1px; }
main a:hover { text-decoration-thickness: 2px; }

/* Hidden until focused: lets keyboard users jump past the navigation. */
.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  padding: .45rem .8rem;
  background: var(--ink); color: var(--paper);
  border-radius: 3px;
  text-decoration: none;
}
.skip-link:focus { top: .75rem; outline: 2px solid var(--yellow); outline-offset: 2px; }

::selection { background: rgba(228, 186, 68, .55); color: var(--ink); }

.btn {
  display: inline-block;
  background-color: var(--red);
  color: #fff3dc;
  padding: .55rem 1.2rem;
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 700;
  border: 1px solid var(--red-dark);
  border-radius: 3px;
  transition: background-color .12s;
}
.btn:hover, .btn:focus-visible { background-color: var(--red-dark); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
/* The secondary action beside a .btn. */
.btn-quiet { background: none; color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover, .btn-quiet:focus-visible { background: rgba(221, 207, 170, .55); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0 0 1.5rem; }

/* Page header: the destination's painted building from the map, then the title. */
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 1.1rem;
  margin: 0 0 1.75rem;
}
/* The destination's building from the map: shown by Map mode (modes/map/pages.css). */
.page-head .place { display: none; flex: none; width: auto; height: 104px; }
.page-head h1 { margin: 0; }
.page-head .meta { margin: .45rem 0 0; font-size: 1rem; color: var(--ink-soft); }

/* A project page's opening sentence. */
p.lede { font-size: 1.25rem; line-height: 1.55; color: var(--ink); max-width: 36rem; margin-bottom: 2rem; }

/* Footer ----------------------------------------------------------------- */
footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0 2.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--ink-soft);
}
footer p { margin: 0; }
footer p:last-child { display: flex; gap: 1.25rem; }
footer a { color: var(--red-dark); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Standard view (index.html #classic) ------------------------------------ */
.masthead {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 0 0 2rem;
}
.profile-pic {
  flex: none;
  width: 116px;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
}
.masthead h1 { margin: 0; }
.masthead .role {
  margin: .5rem 0 0;
  font-size: 1rem;
  letter-spacing: .02em;
  color: var(--ink-soft);
}

/* Project list: image, then name, one line, one action. */
.projects { list-style: none; margin: 1rem 0 0; padding: 0; }
.project {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 1.5rem;
  align-items: start;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}
.project-image { display: block; }
.project img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid #8d8063;
  border-radius: 3px;
}
.project h3 { font-size: 1.35rem; margin: .15rem 0 .5rem; }
.project h3 a { color: var(--ink); text-decoration: none; }
.project h3 a:hover { color: var(--red-dark); text-decoration: underline; }
.project p { margin: 0 0 .75rem; }
.project-cta { font-weight: 700; color: var(--red-dark); }

/* Gallery ---------------------------------------------------------------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 1rem;
  margin: 0 0 1rem;
}
.gallery a { display: block; }
.gallery img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;             /* one row height, whatever each photo's shape */
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 3px;
}


/* Contact ---------------------------------------------------------------- */
.contact-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .9rem 2rem;
  margin: 0;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}
.contact-list dt { font-weight: 700; color: var(--ink-soft); font-size: 1rem; padding-top: .1em; }
.contact-list dd { margin: 0; }
.contact-list a { color: var(--red-dark); }

/* CV ---------------------------------------------------------------------- */
/* The CV as a page (cv.html): education and skills beside the work, as on the
   PDF; one column on narrow screens with the work first. */
.cv .lede { max-width: 44rem; }
.cv-grid {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 0 3rem;
  margin-top: 2.25rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}
.cv-side { grid-column: 1; grid-row: 1; }
.cv-main { grid-column: 2; grid-row: 1; }

.cv h2 { font-size: 1.3rem; margin: 0 0 1.1rem; }
.cv-main section + section { margin-top: 2.25rem; }
.cv-side section + section { margin-top: 2rem; }

.cv-entry { margin: 0 0 1.75rem; }
.cv-entry header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1rem;
  align-items: baseline;
}
.cv-entry h3 { grid-column: 1; font-size: 1.15rem; margin: 0; }
.cv-entry h3 a { color: var(--ink); text-decoration-color: var(--rule); }
.cv-entry h3 a:hover { color: var(--red-dark); text-decoration-color: currentColor; }
.cv .cv-when {
  grid-column: 2; grid-row: 1;
  margin: 0;
  font-size: .95rem;
  color: var(--ink-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cv .cv-org { grid-column: 1 / -1; margin: .2rem 0 0; font-size: 1rem; color: var(--ink-soft); }
.cv-tools { color: var(--ink-soft); font-style: italic; }

.cv-entry ul { list-style: none; margin: .65rem 0 0; padding: 0; }
.cv-entry li {
  position: relative;
  margin: 0 0 .55rem;
  padding-left: 1.1rem;
  font-size: 1.02rem;
  line-height: 1.55;
  text-wrap: pretty;
}
.cv-entry li::before {
  content: '';
  position: absolute;
  left: .1rem;
  top: .8em;
  width: .45rem;
  height: 1px;
  background: var(--ink-soft);
}

.cv-side h3 { font-size: 1.05rem; line-height: 1.3; margin: 0 0 .4rem; }
.cv .cv-side p { font-size: .98rem; line-height: 1.5; margin: 0 0 .3rem; }
.cv-skills { margin: 0; }
.cv-skills dt { font-weight: 700; font-size: .95rem; margin: 1.1rem 0 .3rem; }
.cv-skills dt:first-child { margin-top: 0; }
.cv-skills dd { margin: 0 0 .25rem; font-size: .98rem; line-height: 1.5; color: var(--ink-soft); }
.cv-level { font-style: italic; }

@media (max-width: 800px) {
  .cv-grid { grid-template-columns: minmax(0, 1fr); }
  .cv-side, .cv-main { grid-column: 1; grid-row: auto; }
  .cv-side { margin-top: .5rem; padding-top: 1.75rem; border-top: 1px solid var(--rule); }
}
@media (max-width: 520px) {
  .cv .cv-when { grid-column: 1; grid-row: auto; margin-top: .15rem; }
}

.print-only { display: none; }

/* Printing the page gives a clean CV: no site chrome, black on white, the
   name as the heading and contact links in place of the navigation. */
@media print {
  @page { margin: .5in; }
  html { font-size: 11.5px; }
  .print-only { display: revert; }
  .screen-only { display: none; }
  .cv .lede { font-size: 1.1rem; margin-bottom: 0; }
  .cv-grid { margin-top: 1.25rem; padding-top: 1.25rem; }
  .page-head { margin-bottom: 1rem; }
  nav, footer, .actions, .page-head .place, .iris { display: none !important; }
  html, body { background: #fff; }
  body:not(.game) { min-height: 0; }
  main { width: auto; padding: 0; }
  main p, .cv-skills dd, .cv .cv-org, .cv .cv-when, .cv-tools { color: #333; }
  a { color: inherit; text-decoration: none; }
  .cv-grid { grid-template-columns: 12rem minmax(0, 1fr); gap: 0 2rem; }
  .cv-side { grid-column: 1; grid-row: 1; margin: 0; padding: 0; border: 0; }
  .cv-main { grid-column: 2; grid-row: 1; }
  .cv-entry { break-inside: avoid; }
  .cv h2, .cv-entry header { break-after: avoid; }
}

/* Artwork archive (/art) ------------------------------------------------- */
.world-gallery { margin: 3rem 0; }
.world-gallery > p { max-width: 65ch; margin: 0 0 1.5rem; }
.world-painting { margin: 1.5rem 0 2rem; }
.world-painting img { display: block; width: 100%; height: auto; border: 1px solid #aa9670; border-radius: 5px; }
.world-painting figcaption { margin-top: .5rem; color: #536047; }

.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0 3rem;
}

.art {
  margin: 0;
  text-align: center;
}

.art a { display: block; }

.art img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--paper-dark);
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.art figcaption {
  margin-top: 0.7rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.art figcaption strong { font-weight: 400; color: var(--red-dark); }

.sheet-list {
  display: grid;
  gap: 1.25rem;
  margin: 1.5rem 0 3rem;
}

.sheet {
  margin: 0;
  text-align: center;
}

.sheet img {
  width: 100%;
  max-width: 900px;
  display: block;
  margin: 0 auto;
  padding: 1rem;
  background:
    repeating-conic-gradient(rgba(42, 26, 15, 0.06) 0 25%, transparent 0 50%) 0 0 / 24px 24px,
    var(--paper-dark);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 5px 5px 0 var(--ink);
}

.sheet figcaption {
  margin-top: 0.6rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.sheet figcaption strong { font-weight: 400; color: var(--red-dark); }

.prompt-box {
  text-align: left;
  margin: 0.8rem auto;
  max-width: 760px;
  background: var(--paper-dark);
  border: 3px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 0.6rem 1rem;
}

.prompt-box summary {
  cursor: pointer;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.9rem;
  color: var(--red-dark);
}

.prompt-box pre {
  white-space: pre-wrap;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink);
  margin: 0.6rem 0 0.2rem;
}

/* Phones ------------------------------------------------------------------ */
@media (max-width: 640px) {
  :root { --gutter: 1rem; }
  /* The two nav groups become two centred rows instead of a ragged wrap. */
  nav { flex-direction: column; align-items: center; margin-top: .5rem; font-size: .95rem; }
  .nav-group + .nav-group::before { display: none; }
  nav a { padding: .45rem .6rem; }

  main { padding: 1.75rem 0 3rem; }
  .page-head { gap: .8rem; }
  .page-head .place { height: 76px; }
  .masthead { gap: 1rem; }
  .profile-pic { width: 84px; }

  .project { grid-template-columns: 1fr; gap: .9rem; }

  .contact-list { grid-template-columns: 1fr; gap: .15rem; }
  .contact-list dd + dt { margin-top: .9rem; }
}
