/* New Terra Studios
   Palette, type and spacing taken directly from the original site's
   custom.css so this matches rather than approximates it. */

:root {
  /* backgrounds */
  --bg:           #171210;  /* page */
  --bg-raised:    #211a14;  /* inputs */
  --bg-hover:     #2c2218;  /* hover states */
  --bg-header:    #100d0a;  /* header bar */
  --bg-footer:    #0d0b08;  /* footer */
  --bg-submenu:   #1a1208;  /* nav dropdowns */
  --bg-card:      #160f0a;  /* promo / project cards */

  /* accents */
  --amber:        #c47d35;
  --amber-light:  #d9983f;
  --sienna:       #7a5533;
  --sage:         #4a7a58;
  --sage-light:   #5c9470;  /* link hover */

  /* text */
  --text:         #e8dcc8;
  --text-muted:   #a8947a;
  --text-faint:   #6b5c4a;
  --on-amber:     #0f0c09;  /* text on amber buttons */
  --on-hero:      #1a1208;  /* dark text over the bright hero art */

  /* lines */
  --border:       #3a2d20;
  --border-light: #4a3a28;

  --font-display: 'Cinzel', serif;
  --font-body: 'Crimson Pro', Georgia, serif;

  --radius-sm: 3px;
  --radius: 6px;
  --radius-lg: 12px;

  --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  --container: 1240px;
  --header-h: 50px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.site-main { flex: 1 0 auto; }
.site-header, .site-footer { flex-shrink: 0; }

/* Cinzel is an inscriptional face — its lowercase already reads like
   small caps, so no font-variant trickery is needed here. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--amber);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

p { margin-bottom: 1.2em; }

strong, b { color: var(--amber-light); font-weight: 600; }

a {
  color: var(--amber);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover { color: var(--sage-light); text-decoration: underline; }
nav a:hover, .btn:hover { text-decoration: none; }

img { max-width: 100%; display: block; }

::selection { background: var(--amber); color: var(--on-amber); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--sienna); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--amber); }

.section-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 2rem;
  min-height: var(--header-h);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}

/* Logo and tabs travel together on the left; socials sit far right. */
.header-left {
  display: flex;
  align-items: flex-end;
  gap: 1.75rem;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  min-height: var(--header-h);
  padding: 0.4rem 0;
  flex-shrink: 0;
}

.brand-logo { height: 46px; width: auto; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text-muted);
  border-radius: 1px;
}

.nav-list {
  list-style: none;
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.nav-item, .nav-subitem { position: relative; }

/* Tabs: boxed, open-bottomed, sitting on the header's baseline so they
   read as folder tabs rather than plain links. */
.nav-tab {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--bg-submenu);
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.6;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-tab:hover {
  background: var(--bg-hover);
  color: var(--amber);
  text-decoration: none;
}

/* Active tab joins the page below it by covering the header border. */
.nav-tab.is-active {
  background: var(--bg);
  color: var(--amber);
  border-color: var(--border-light);
  position: relative;
  z-index: 2;
  margin-bottom: -1px;
  padding-bottom: calc(0.5rem + 1px);
}

.nav-dropdown {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  min-width: 230px;
  background: var(--bg-submenu);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 20;
}

.nav-item.has-dropdown:hover > .nav-dropdown,
.nav-item.has-dropdown:focus-within > .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown li a,
.nav-flyout li a {
  display: block;
  padding: 0.5rem 1.1rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.nav-dropdown li a:hover,
.nav-flyout li a:hover {
  background: var(--bg-hover);
  color: var(--amber);
}

/* second level, for a project's own subpages */
.nav-flyout {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
  position: absolute;
  top: 0;
  right: 100%;
  min-width: 210px;
  background: var(--bg-submenu);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateX(6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 21;
}

.nav-subitem.has-flyout > a::after {
  content: "\2039";
  float: left;
  margin-right: 0.4rem;
  opacity: 0.6;
}

.nav-subitem.has-flyout:hover > .nav-flyout,
.nav-subitem.has-flyout:focus-within > .nav-flyout {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* ---------- social icons in header ---------- */

.social-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0;
  margin: 0;
}

.social-links a {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
}

.social-links a:hover { color: var(--amber); text-decoration: none; }

/* Socials sit bare in the header — deliberately no boxed tab styling. */
.header-social {
  border: none;
  background: none;
  padding-bottom: 0.6rem;
}

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

/* The original runs dark text straight over the artwork with no
   scrim, which is why it reads as bright and open. */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
}

.hero-short  { min-height: 28vh; }
.hero-medium { min-height: 40vh; }
.hero-tall   { min-height: 60vh; }

.hero-content {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

.hero-intro,
.hero-intro p,
.hero-intro strong,
.hero h1 {
  color: var(--on-hero);
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1.4;
  overflow-wrap: break-word;
  margin: 0;
}

.hero-intro strong { font-weight: 700; }

/* No artwork behind it? Dark text would vanish — use the light one. */
.hero-plain { min-height: 0; padding: 3rem 2rem 2rem; }
.hero-plain .hero-intro,
.hero-plain .hero-intro p,
.hero-plain .hero-intro strong,
.hero-plain h1 { color: var(--amber); }

.page-intro {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem 1.5rem;
  text-align: center;
}

.page-intro h1 { font-size: 2.2rem; margin-bottom: 0.75rem; }

/* ---------- homepage two-column layout ---------- */

.home-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 3rem;
  align-items: start;
  padding: 3rem 0;
}

/* the dashed rule between the two columns */
.home-main {
  border-left: 1px dashed var(--border-light);
  padding-left: 3rem;
  min-width: 0;
}

.column-heading {
  font-size: 1.35rem;
  margin: 0 0 1.5rem;
}

/* Left column: projects stacked vertically. No outer frame — the cards
   already have their own borders, and a box around boxes just reads as
   visual noise. */
.home-projects .project-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.home-news { margin-bottom: 3rem; }

.empty-note { color: var(--text-faint); font-style: italic; }

.read-more {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.feed-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.feed-link:hover { color: var(--amber); text-decoration: none; }

/* ---------- project cards ---------- */

/* Used on the Projects index page, where cards sit side by side. */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
  justify-content: center;
  gap: 2rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
  /* Everything inside the card is centred; flex column keeps the
     status pill and button stacked and centred under the text. */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
}

.project-card__image { width: 100%; display: block; }

/* Show the whole cover — never crop to a fixed ratio. */
.project-card img { width: 100%; height: auto; }

.project-stack .project-card {
  background: transparent;
  border-color: var(--border-light);
}

.project-stack .project-card + .project-card { margin-top: 0; }

.project-card h2, .project-card h3 {
  margin: 1rem 1rem 0.25rem;
  font-size: 1.25rem;
}

.project-card .tagline {
  margin: 0 1rem 0.9rem;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
}

/* Small caption above the pill so the value has obvious context. */
.status-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin: 0 1rem 1rem;
}

.status-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* Left-aligned contexts (project page) rather than centred cards. */
.project-hero .status-block,
.project-content .status-block {
  align-items: flex-start;
  margin-left: 0;
}

.status {
  display: inline-block;
  margin: 0;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.status-live          { background: var(--sage); border-color: var(--sage); color: #fff; }
.status-coming_soon   { background: var(--amber); border-color: var(--amber); color: var(--on-amber); }
.status-playtesting   { background: var(--sienna); border-color: var(--sienna); color: var(--text); }
.status-development   { background: var(--bg-raised); color: var(--text-muted); }
.status-pre_production,
.status-production    { background: var(--amber-light); border-color: var(--amber-light); color: var(--on-amber); }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  margin: 0 1rem 1.25rem;
  padding: 0.6rem 1.4rem;
  background: var(--amber);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  color: var(--on-amber);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  background: var(--amber-light);
  border-color: var(--amber-light);
  color: var(--on-amber);
}

/* ---------- project layout (sidebar + content) ---------- */

.project-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.5rem;
  max-width: var(--container);
  margin: 0 auto;
  padding: 2.5rem 2rem;
  align-items: start;
}

.project-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.project-sidebar h2 {
  font-size: 0.78rem;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav a {
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-nav a:hover {
  background: var(--bg-hover);
  color: var(--amber);
  text-decoration: none;
}

.sidebar-nav a.is-active {
  background: var(--amber);
  color: var(--on-amber);
}

/* Same container as project-layout, minus the sidebar column. Used by
   pages that don't belong to a project. */
.page-layout {
  max-width: var(--container);
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

.project-content { min-width: 0; }

/* ---------- single project ---------- */

.project-hero { padding: 0 0 1rem; text-align: left; }

.project-hero h1 { font-size: 2rem; margin: 0 0 0.5rem; }

/* Full artwork, no cropping — height follows the image's own
   proportions instead of being forced into a fixed band. */
.project-cover {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.project-hero .tagline { color: var(--text-muted); margin-bottom: 0.75rem; }
.project-hero .system { color: var(--text-faint); font-size: 0.95rem; }

.project-description { padding: 0 0 2rem; text-align: left; }

.project-links { text-align: left; padding-bottom: 2rem; }
.project-links .btn { margin-left: 0; margin-right: 1rem; }

/* ---------- news ---------- */

.article-list { padding: 0 0 3rem; }

.article-preview {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
}

.article-preview h2 { font-size: 1.3rem; margin: 0.3rem 0; }

.article-preview time,
.article-header time,
.news-preview time {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-full { padding: 2rem 0 3rem; }
.article-header h1 { font-size: 2rem; margin: 0.3rem 0 1rem; }

.article-cover {
  border-radius: var(--radius);
  margin: 1rem 0 1.5rem;
  border: 1px solid var(--border);
}

.back-link { display: inline-block; margin-top: 2rem; }

.news-preview-list {
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}

.news-preview {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
}

.news-preview h3 { margin: 0.3rem 0; font-size: 1.2rem; }
.news-preview p { margin: 0; color: var(--text-muted); }

/* ---------- text pages ---------- */

.text-page { padding: 1rem 0 3rem; }
.text-page h1 { font-size: 2rem; margin-bottom: 1rem; }
.text-page .intro { font-size: 1.2rem; color: var(--text-muted); }

/* ---------- images inside body text ---------- */

/* Kirbytext wraps (image: ...) in a <figure>, and adds <figcaption>
   when a caption is given. */
.text-page figure,
.article-body figure,
.project-description figure {
  margin: 2rem 0;
  max-width: 100%;
}

.text-page figure img,
.article-body figure img,
.project-description figure img,
.text-page .content img,
.article-body img {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.text-page figcaption,
.article-body figcaption,
.project-description figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-faint);
  font-style: italic;
  text-align: center;
}

/* class: left / class: right on the kirbytag floats the image and
   lets the body copy wrap around it. */
.text-page figure.left,
.article-body figure.left,
.project-description figure.left {
  float: left;
  max-width: 45%;
  margin: 0.4rem 2rem 1.25rem 0;
}

.text-page figure.right,
.article-body figure.right,
.project-description figure.right {
  float: right;
  max-width: 45%;
  margin: 0.4rem 0 1.25rem 2rem;
}

/* Stop a floated image from bleeding past the end of its section. */
.text-page .content::after,
.article-body::after,
.project-description::after {
  content: "";
  display: block;
  clear: both;
}

/* Floats get cramped on phones — go full width instead. */
@media (max-width: 640px) {
  .text-page figure.left,
  .text-page figure.right,
  .article-body figure.left,
  .article-body figure.right,
  .project-description figure.left,
  .project-description figure.right {
    float: none;
    max-width: 100%;
    margin: 1.5rem 0;
  }
}

/* ---------- newsletter ---------- */

/* Sits inside the right-hand column, so it's a panel rather than a
   full-bleed band. */
.newsletter {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.newsletter-form {
  max-width: 440px;
  margin: 1.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  text-align: left;
}

.newsletter-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.newsletter-form label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.newsletter-form .required { color: var(--amber); }

.newsletter-form input[type="email"],
.newsletter-form input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
}

.newsletter-form input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(196, 125, 53, 0.2);
  outline: none;
}

.newsletter-form .field-check {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}

.newsletter-form .field-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--amber);
  flex-shrink: 0;
}

.newsletter-form .field-check label {
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: normal;
  font-size: 1rem;
  color: var(--text);
}

.newsletter-form .btn { margin: 0.25rem 0 0; align-self: flex-start; }

.form-success { color: var(--sage-light); font-weight: 600; }
.form-error { color: var(--amber-light); font-weight: 600; }

.form-legal {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin: 0.75rem 0 0;
  line-height: 1.4;
}

.form-legal a { color: var(--text-faint); text-decoration: underline; }
.form-legal a:hover { color: var(--amber); }

/* Google's badge is hidden, which their terms allow as long as the
   attribution above stays visible. */
.grecaptcha-badge { visibility: hidden; }

/* Honeypot: off-screen rather than display:none, since some bots
   skip hidden fields but still fill positioned ones. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- footer ---------- */

.site-footer {
  background: var(--bg-footer);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2rem;
  text-align: center;
  font-size: 0.95rem;
}

.site-footer p { margin: 0; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--amber); }

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .home-layout { grid-template-columns: 1fr; gap: 2.5rem; }

  /* No side-by-side columns, so the dashed rule becomes a divider
     above the news column instead of beside it. */
  .home-main {
    border-left: none;
    border-top: 1px dashed var(--border-light);
    padding-left: 0;
    padding-top: 2.5rem;
  }

  /* Once the columns stack, lay the projects out side by side — but cap
     the track width and centre them, otherwise a single card lands in
     the first of three tracks with dead space beside it. */
  .home-projects .project-stack {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 320px));
    justify-content: center;
    gap: 1.25rem;
  }
}

@media (max-width: 860px) {
  .nav-toggle { display: flex; order: 2; align-self: center; }

  .header-inner {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
  }

  .header-left {
    order: 1;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 0;
  }

  .header-social {
    order: 3;
    flex: 0 0 auto;
    padding-bottom: 0;
  }

  /* Nav drops to its own full-width row under the logo when opened. */
  .site-nav { order: 4; width: 100%; display: none; }
  .site-nav.is-open { display: block; }

  .nav-list { flex-direction: column; align-items: stretch; gap: 0; padding: 0.5rem 0; }

  /* Tabs flatten into plain rows on mobile — folder tabs don't
     make sense in a vertical stack. */
  .nav-tab {
    display: block;
    border: none;
    border-radius: 0;
    background: none;
    padding: 0.7rem 0;
    margin-bottom: 0;
  }

  .nav-tab.is-active { background: none; padding-bottom: 0.7rem; }

  /* Hover doesn't exist on touch — expand submenus inline instead. */
  .nav-dropdown,
  .nav-flyout {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    background: none;
    min-width: 0;
    padding-left: 1rem;
  }

  .nav-flyout { padding-left: 2rem; }

  .project-layout { grid-template-columns: 1fr; }
  .project-sidebar { position: static; }

  .hero-short, .hero-medium, .hero-tall { min-height: 34vh; }
  .hero-intro, .hero-intro p, .hero h1 { font-size: 1.25rem; }

  .section-inner { padding-left: 1.25rem; padding-right: 1.25rem; }
}
