:root {
  --bg: #f2f0ec;
  --ink: #161514;
  --muted: #6f6b65;
  --line: #d8d4cc;
  --panel: #e8e4dc;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter Tight", system-ui, sans-serif;
  --pad: clamp(20px, 4vw, 56px);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

section {
  padding: clamp(72px, 10vw, 150px) var(--pad);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(44px, 8vw, 128px); }
h2 { font-size: clamp(36px, 5.5vw, 84px); }
h3 { font-size: clamp(26px, 3vw, 40px); }

em { font-style: italic; }

.small {
  font-size: 14px;
  color: var(--muted);
}

.btn {
  display: inline-block;
  padding: 14px 26px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.btn:hover {
  background: var(--ink);
  color: var(--bg);
}

.btn.solid {
  background: var(--ink);
  color: var(--bg);
}

.btn.solid:hover {
  background: transparent;
  color: var(--ink);
}

/* Header Navigation */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) var(--pad) 16px;
  mix-blend-mode: difference;
  color: #fff;
}

.nav a {
  color: #fff;
  cursor: pointer;
}

.logo {
  font-family: var(--serif);
  font-size: 28px;
}

.nav ul {
  display: flex;
  gap: 28px;
  list-style: none;
  font-size: 15px;
}

@media (max-width: 760px) {
  .nav ul li:not(:last-child) {
    display: none;
  }
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: 140px;
}

.hero .eyebrow {
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-live-time {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.hero h1 { max-width: 14em; }

.hero .lead {
  max-width: 34em;
  margin-top: 32px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 32px;
  flex-wrap: wrap;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.stat b {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 56px;
  line-height: 1;
}

/* Marquee */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: 28px 0;
}

.track {
  display: flex;
  gap: 72px;
  width: max-content;
  animation: scroll 32s linear infinite;
}

.track span {
  font-family: var(--serif);
  font-size: 34px;
  white-space: nowrap;
}

@keyframes scroll {
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .track { animation: none; }
  html { scroll-behavior: auto; }
}

/* Work Section */
.work-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 48px;
  gap: 24px;
  flex-wrap: wrap;
}

.case {
  display: grid;
  grid-template-columns: 80px 1fr 1.2fr 200px;
  gap: 32px;
  align-items: center;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}

.case:last-of-type {
  border-bottom: 1px solid var(--line);
}

.case .thumb {
  aspect-ratio: 16/10;
  background: var(--panel);
  border-radius: 6px;
  overflow: hidden;
}

.case .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.case:hover .thumb img {
  transform: scale(1.03);
}

.case .kind {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.1;
}

.case:hover h3 {
  font-style: italic;
}

@media (max-width: 900px) {
  .case { grid-template-columns: 1fr 1fr; }
  .case .thumb { grid-column: 1 / -1; }
}

/* Section Layouts */
.intro {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(32px, 6vw, 96px);
  align-items: flex-end;
}

.intro p {
  max-width: 34em;
  color: var(--muted);
  margin-top: 24px;
}

@media (max-width: 800px) {
  .intro { grid-template-columns: 1fr; }
}

.news {
  background: var(--ink);
  color: var(--bg);
}

.news h2 { margin-bottom: 56px; }

.news-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 6vw, 96px);
}

.news article {
  border-top: 1px solid rgba(242, 240, 236, 0.3);
  padding-top: 28px;
}

.news article p {
  margin: 16px 0 28px;
  opacity: 0.75;
  max-width: 30em;
}

.news a { border-bottom: 1px solid currentColor; }

@media (max-width: 800px) {
  .news-grid { grid-template-columns: 1fr; }
}

.cta {
  text-align: center;
  padding-block: clamp(100px, 14vw, 220px);
}

.cta h2 {
  font-size: clamp(48px, 9vw, 150px);
  margin-bottom: 24px;
}

.cta p {
  color: var(--muted);
  margin-bottom: 48px;
}

.cta .insta {
  margin-top: 40px;
  margin-bottom: 0;
}

/* Inner Pages Header & Grid */
.page-header {
  padding-top: 180px;
  padding-bottom: 60px;
}

.page-header h1 {
  font-size: clamp(48px, 8vw, 110px);
  margin-bottom: 24px;
}

.page-header p.lead {
  font-size: clamp(20px, 2.5vw, 32px);
  color: var(--muted);
  max-width: 32em;
  line-height: 1.3;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(32px, 6vw, 96px);
  padding-block: 60px;
  border-top: 1px solid var(--line);
}

@media (max-width: 800px) {
  .grid-2col { grid-template-columns: 1fr; }
}

.principle-item {
  padding-block: 32px;
  border-top: 1px solid var(--line);
}

.principle-item h3 {
  margin-bottom: 12px;
  font-size: 32px;
}

.principle-item p {
  color: var(--muted);
  max-width: 36em;
}

/* Contact Form */
.contact-form {
  display: grid;
  gap: 24px;
  margin-top: 32px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  font-family: var(--sans);
  font-size: 18px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--ink);
}

/* Site Footer */
footer.site {
  padding: 56px var(--pad) 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px;
  font-size: 15px;
}

footer.site ul {
  list-style: none;
  display: grid;
  gap: 6px;
}

footer.site .col-title {
  color: var(--muted);
  margin-bottom: 10px;
}

footer.site .brand p {
  max-width: 22em;
  color: var(--muted);
  margin: 12px 0 20px;
}

@media (max-width: 800px) {
  footer.site { grid-template-columns: 1fr 1fr; }
  footer.site .brand { grid-column: 1 / -1; }
}

/* Status Bar */
.status-bar {
  background: var(--bg);
  color: var(--ink);
  padding: 28px var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-family: var(--sans);
  border-top: 1px solid var(--line);
}

.status-bar .col-left { display: flex; flex-direction: column; gap: 4px; }
.status-bar .col-center { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.status-bar .col-right { text-align: right; font-size: 14px; color: var(--ink); }

.status-bar a.top-link {
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.status-bar a.top-link:hover { opacity: 0.6; }

@media (max-width: 768px) {
  .status-bar {
    flex-direction: column;
    gap: 16px;
    text-align: left;
    align-items: flex-start;
  }
  .status-bar .col-center,
  .status-bar .col-right { text-align: left; }
}

/* Dynamic Texture Banner */
.footer-texture-wrapper {
  width: 100%;
  height: 220px;
  position: relative;
  overflow: hidden;
  background: #161514;
  cursor: crosshair;
  border-top: 1px solid var(--line);
}

.footer-texture-wrapper canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Added: active nav state + anchor offset for fixed header */
.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; }
.case[id] { scroll-margin-top: 100px; }
footer.site + .status-bar { margin-top: 56px; }


/* ===== Logo (image + text wordmark) ===== */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-img { height: 28px; width: auto; display: block; }

/* ===== Image frames (all editable image slots) ===== */
.frame { background: var(--panel); border-radius: 6px; overflow: hidden; }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame.cover { aspect-ratio: 16/10; }
.frame.wide { aspect-ratio: 16/9; }
.frame.half { aspect-ratio: 4/3; }
.frame.portrait { aspect-ratio: 4/5; }

/* ===== Case-study pages ===== */
.back-link { display: inline-block; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.back-link:hover { color: var(--ink); border-color: var(--ink); }
.project-cover { padding-block: 0 clamp(32px, 5vw, 64px); }
.project-info { padding-block: 0; }
.project-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  padding-block: 32px;
  border-block: 1px solid var(--line);
}
.project-meta dt, .facts dt {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.project-meta dd { font-family: var(--serif); font-size: 26px; line-height: 1.15; }
.project-body { padding-block: clamp(40px, 6vw, 80px) 0; }
.project-block {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(32px, 6vw, 96px);
  padding-block: 40px;
  border-top: 1px solid var(--line);
}
.project-block p { color: var(--muted); font-size: 19px; max-width: 38em; }
.project-block p + p { margin-top: 16px; }
@media (max-width: 800px) { .project-block { grid-template-columns: 1fr; gap: 16px; } }
.project-gallery h2 { margin-bottom: 40px; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gallery .wide { grid-column: 1 / -1; }
.gallery figcaption { margin-top: 10px; }
@media (max-width: 700px) { .gallery { grid-template-columns: 1fr; } }
.next-project { border-top: 1px solid var(--line); }
.next-project a { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.next-project h2 { margin-top: 12px; }
.next-project a:hover h2 { font-style: italic; }
.next-project a:hover .btn { background: var(--ink); color: var(--bg); }

/* ===== About page ===== */
.page-header h1 em { font-style: italic; }
.founder {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) 1.2fr;
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
  border-top: 1px solid var(--line);
}
.founder .portrait { position: sticky; top: 100px; }
.founder h2 { margin: 16px 0 24px; }
.founder p { color: var(--muted); max-width: 36em; margin-top: 16px; }
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 32px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
@media (max-width: 800px) {
  .founder { grid-template-columns: 1fr; }
  .founder .portrait { position: static; max-width: 420px; }
  .facts { grid-template-columns: 1fr; }
}
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 24px; margin-top: 48px; }
.person h3 { font-size: 28px; margin-top: 16px; }
.person p { margin-top: 4px; }
.made-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 48px; border-top: 1px solid var(--line); }
.made-card { padding: 32px 24px 32px 0; }
.made-card .letter { display: block; font-family: var(--serif); font-size: 96px; line-height: 1; margin-bottom: 12px; }
.made-card h3 { margin-bottom: 8px; }
.made-card p { color: var(--muted); max-width: 22em; }

/* ===== Wordmark: "Madebyramad Design Studio" (header only; footer logo removed) ===== */
footer.site .brand p { margin-top: 0; }
@media (max-width: 1000px) {
  .logo { font-size: 20px; line-height: 1.02; gap: 8px; }
  .logo-img { height: 24px; }
  .logo-text { max-width: 6.8em; } /* wraps to two lines: Madebyramad / Design Studio· */
}
