/* ===========================================================================
   NML COLLECTION — stylesheet
   Two styles: white (default) and black (<html class="dark">).
   Change colours in the two blocks below; nothing else hardcodes a colour.
   =========================================================================== */

:root {
  --bg: #f8f7f4;
  --fg: #16150f;
  --surface: #efeeea;
  --muted: #6f6d65;
  --border: rgba(22, 21, 15, 0.14);
  --input: rgba(22, 21, 15, 0.28);
  --logo-filter: none;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Jost", ui-sans-serif, system-ui, sans-serif;
  --max: 1600px;
}

html.dark {
  --bg: #131311;
  --fg: #eeece6;
  --surface: #1d1d1a;
  --muted: #9d9b93;
  --border: rgba(238, 236, 230, 0.16);
  --input: rgba(238, 236, 230, 0.28);
  --logo-filter: invert(1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-weight: 300;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
::selection { background: var(--fg); color: var(--bg); }

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 300; line-height: 1.02; letter-spacing: -0.01em; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.6875rem; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--muted);
}
.muted { color: var(--muted); }
.small { font-size: 0.875rem; line-height: 1.7; }
.tiny { font-size: 0.75rem; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; }

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: 1.25rem; }

.ico { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-block; border: 1px solid var(--fg);
  padding: 1rem 2rem; font-size: 0.7rem; letter-spacing: 0.28em;
  text-transform: uppercase; background: none; cursor: pointer;
  transition: background-color .3s, color .3s;
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn-ghost { border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { background: none; border-color: var(--fg); color: var(--fg); }

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; background: none;
  border: 1px solid transparent; cursor: pointer; transition: border-color .3s;
}
.icon-btn:hover { border-color: var(--border); }
.icon-btn.bordered { width: 2.75rem; height: 2.75rem; border-color: var(--border); }
.icon-btn.bordered:hover { border-color: var(--fg); }

.rule-link {
  display: inline-block; margin-top: 2rem; padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem; letter-spacing: 0.28em; text-transform: uppercase;
  transition: border-color .3s;
}
.rule-link:hover { border-color: var(--fg); }

/* --- Header ------------------------------------------------------------- */
#site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  transition: background-color .5s, border-color .5s;
  border-bottom: 1px solid transparent;
}
#site-header.scrolled { background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); border-bottom-color: var(--border); }
.bar { max-width: var(--max); margin-inline: auto; height: 5rem; padding-inline: 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.logo { height: 2.25rem; width: auto; filter: var(--logo-filter); }
.logo-link { display: block; flex-shrink: 0; }

.desktop-nav { display: none; gap: 2rem; }
.desktop-nav a { font-size: 0.6875rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted); transition: color .3s; }
.desktop-nav a:hover, .desktop-nav a.active { color: var(--fg); }

.bar-actions { display: flex; align-items: center; gap: 0.25rem; }
.desktop-only { display: none; }

.search-wrap { position: relative; }
.search-ico { position: absolute; left: 0; top: 50%; transform: translateY(-50%); color: var(--muted); width: .9rem; height: .9rem; }
.search-input {
  width: 8rem; padding: .5rem 0 .5rem 1.5rem; background: none;
  border: none; border-bottom: 1px solid var(--border);
  font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; outline: none;
  transition: width .5s, border-color .3s;
}
.search-input:focus { width: 14rem; border-bottom-color: var(--fg); }

.results {
  position: absolute; right: 0; top: 100%; margin-top: .75rem; width: 20rem;
  list-style: none; border: 1px solid var(--border); background: var(--bg);
  padding: .5rem; box-shadow: 0 20px 40px rgba(0,0,0,.25);
}
.results button, .results-mobile button { width: 100%; text-align: left; background: none; border: none; padding: .5rem .75rem; cursor: pointer; }
.results button:hover { background: var(--surface); }
.results .t, .results-mobile .t { display: block; font-size: .875rem; }

#mobile-panel { border-top: 1px solid var(--border); background: var(--bg); padding: 1.5rem 1.25rem; }
.mobile-search { display: flex; align-items: center; gap: .75rem; border-bottom: 1px solid var(--border); padding-bottom: .75rem; margin-bottom: 1.5rem; }
.mobile-search input { flex: 1; background: none; border: none; outline: none; font-size: .95rem; }
#mobile-nav { display: flex; flex-direction: column; }
#mobile-nav a { display: flex; align-items: baseline; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border); }
#mobile-nav a:last-child { border-bottom: none; }
#mobile-nav .display { font-size: 1.875rem; }
.results-mobile { list-style: none; }
.results-mobile button { padding: .75rem 0; }

.ico-close, .ico-moon { display: none; }
#menu-toggle.open .ico-menu { display: none; }
#menu-toggle.open .ico-close { display: block; }
html:not(.dark) .ico-sun { display: none; }
html:not(.dark) .ico-moon { display: block; }

/* --- Hero --------------------------------------------------------------- */
.hero { position: relative; display: flex; align-items: flex-end; min-height: 92svh; overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.hero-scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 25%, transparent); }
.hero-fade { position: absolute; left: 0; right: 0; bottom: 0; height: 66%;
  background: linear-gradient(to top, var(--bg), color-mix(in srgb, var(--bg) 60%, transparent), transparent); }
.hero-inner { position: relative; width: 100%; padding-bottom: 4rem; }
.hero-title { margin-top: 1rem; font-size: clamp(2.75rem, 9vw, 6.5rem); max-width: 20ch; }
.hero-text { margin-top: 1.5rem; max-width: 28rem; font-size: .875rem; line-height: 1.7; }
.hero-actions { margin-top: 2.5rem; display: flex; flex-wrap: wrap; gap: 1rem; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: rise 700ms cubic-bezier(.22,1,.36,1) both; }

/* --- Sections ----------------------------------------------------------- */
.section { border-top: 1px solid var(--border); padding: 5rem 0; scroll-margin-top: 5rem; }
.section.surface { background: var(--surface); }
.section-head { margin-bottom: 2.5rem; display: flex; flex-direction: column; gap: 1rem; }
.section-head h2 { margin-top: .75rem; font-size: clamp(2.25rem, 6vw, 3.75rem); }
.section-head p { max-width: 28rem; }
.h-md { margin-top: .75rem; font-size: clamp(1.875rem, 4vw, 3rem); }
.h-sm { margin-top: .5rem; font-size: 1.5rem; }
.lead { font-size: 1.5rem; line-height: 1.35; }

/* --- Portfolio rail ----------------------------------------------------- */
.rail { display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 1.25rem .5rem; scroll-padding-left: 1.25rem; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.piece { width: 78vw; flex-shrink: 0; scroll-snap-align: start; }
.frame { overflow: hidden; background: var(--surface); }
.frame img { width: 100%; transition: transform 1.2s ease-out; }
.frame:hover img { transform: scale(1.03); }
.piece .frame img { height: 62vh; object-fit: cover; }
.ratio img { aspect-ratio: 4 / 3; object-fit: cover; }
.piece figcaption { margin-top: 1rem; display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; border-top: 1px solid var(--border); padding-top: .75rem; }
.piece h3 { font-family: var(--font-sans); font-size: 1.05rem; }
.rail-controls { display: none; gap: .75rem; margin-top: 2rem; }

/* --- Grids -------------------------------------------------------------- */
.grid-12 { display: grid; gap: 2.5rem; }
.two-col { display: grid; gap: 2.5rem; }
.card-body { margin-top: 1.25rem; border-top: 1px solid var(--border); padding-top: 1rem; }

.pillars { margin-top: 2.5rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.pillars > div { display: grid; gap: .5rem; padding: 1.25rem 0; border-bottom: 1px solid var(--border); }
.pillars > div:last-child { border-bottom: none; }

/* --- Lookup & forms ----------------------------------------------------- */
.lookup-form { display: flex; flex-direction: column; gap: .75rem; }
#piece-code { width: 100%; background: none; border: none; border-bottom: 1px solid var(--input);
  padding: .75rem 0; font-size: 1.125rem; letter-spacing: .14em; text-transform: uppercase; outline: none; }
#piece-code:focus { border-bottom-color: var(--fg); }
.lookup-result { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.lookup-result dl { display: grid; gap: 1rem 2rem; }
.lookup-result dd { margin-top: .25rem; font-size: 1rem; }

.contact-form { display: grid; gap: 2rem; justify-items: start; }
.field { width: 100%; }
.field input, .field textarea { width: 100%; margin-top: .5rem; background: none; border: none;
  border-bottom: 1px solid var(--input); padding: .5rem 0; font-size: 1rem; outline: none; resize: none; }
.field input:focus, .field textarea:focus { border-bottom-color: var(--fg); }
.mail-link { display: block; margin-top: .75rem; transition: opacity .3s; }
.mail-link:hover { opacity: .6; }

/* --- Footer ------------------------------------------------------------- */
footer { border-top: 1px solid var(--border); padding: 3.5rem 0; }
.footer-inner { display: flex; flex-direction: column; gap: 2.5rem; }
.footer-logo { height: 3rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: .75rem 2rem; }
.footer-nav a { font-size: .6875rem; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); transition: color .3s; }
.footer-nav a:hover { color: var(--fg); }

/* --- Larger screens ----------------------------------------------------- */
@media (min-width: 640px) {
  .piece { width: 46vw; }
  .lookup-form { flex-direction: row; }
  .lookup-form .btn { flex-shrink: 0; }
  .lookup-result dl { grid-template-columns: 1fr 1fr; }
  .pillars > div { grid-template-columns: 1fr 2fr; }
}

@media (min-width: 768px) {
  .wrap, .bar, .rail { padding-inline: 2.5rem; }
  .rail { scroll-padding-left: 2.5rem; }
  .desktop-only { display: block; }
  .bar-actions { gap: .75rem; }
  .logo { height: 2.75rem; }
  .section { padding: 8rem 0; }
  .section-head { flex-direction: row; align-items: flex-end; justify-content: space-between; margin-bottom: 4rem; }
  .hero-inner { padding-bottom: 6rem; }
  .grid-12 { grid-template-columns: repeat(12, 1fr); gap: 3.5rem; }
  .grid-12.align-center { align-items: center; }
  .col-5 { grid-column: span 5; }
  .col-6 { grid-column: span 6; }
  .col-7 { grid-column: span 7; }
  .two-col { grid-template-columns: 1fr 1fr; gap: 3.5rem; }
  .rail-controls { display: flex; }
  .footer-inner { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .lead { font-size: 1.875rem; }
  .h-sm { font-size: 1.875rem; }
}

@media (min-width: 1024px) {
  .piece { width: 30vw; }
  .desktop-nav { display: flex; }
  .mobile-only { display: none; }
  #mobile-panel { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
