/*
 * pages.css: inner pages (work, automation lab, case studies, contact, legal)
 * on top of site.css.
 */

/* names the ported case-study components expect */
:root {
  --bg-subtle: color-mix(in srgb, var(--text) 4%, var(--bg));
  --text-main: var(--text);
  --border: var(--line);
  --border-strong: color-mix(in srgb, var(--text) 22%, var(--bg));
  --accent-blue: var(--accent);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-soft: rgba(0, 0, 0, 0.08);
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --ok-line: #a7f3d0;
}
:root[data-theme="dark"] { --ok: #6fdcb0; --ok-bg: rgba(52, 211, 153, 0.12); --ok-line: rgba(52, 211, 153, 0.3); }

body.inner { padding-top: 72px; }

/* sky band behind the top of every inner page */
.scene-inner {
  top: 0; height: 380px;
  background: linear-gradient(var(--sky-1), var(--sky-2) 48%, var(--sky-3) 86%);
  -webkit-mask-image: linear-gradient(#000 20%, transparent 96%); mask-image: linear-gradient(#000 20%, transparent 96%);
  transition: opacity 0.5s var(--ease);
}
.scene-inner::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s var(--ease);
  background-image:
    radial-gradient(1.2px 1.2px at 12% 22%, #dfe6ff 50%, transparent 51%), radial-gradient(1px 1px at 27% 58%, #dfe6ff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 41% 14%, #dfe6ff 50%, transparent 51%), radial-gradient(1px 1px at 55% 44%, #dfe6ff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 68% 20%, #dfe6ff 50%, transparent 51%), radial-gradient(1px 1px at 79% 62%, #dfe6ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 30%, #dfe6ff 50%, transparent 51%), radial-gradient(1px 1px at 6% 70%, #dfe6ff 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 36%, #dfe6ff 50%, transparent 51%), radial-gradient(1.2px 1.2px at 95% 12%, #dfe6ff 50%, transparent 51%);
  background-size: 620px 380px;
}
[data-theme="dark"] .scene-inner::after { opacity: 0.9; }

.shell { position: relative; z-index: 1; width: min(100% - 2 * var(--gutter), 920px); margin-inline: auto; }

.site-foot { position: relative; z-index: 1; width: min(100% - 2 * var(--gutter), 920px); margin-inline: auto; padding: 72px 0 130px; font-size: 15px; border-top: 1px solid var(--line); margin-top: 72px; }
.site-foot p + p { color: var(--text-muted); }
.site-foot a { border-bottom: 1px solid transparent; transition: border-color 0.2s, color 0.2s; }
.site-foot a:hover { color: var(--text); border-color: var(--text-dim); }

/* ---------- Generic page header ---------- */
.page-header { padding: 56px 0 32px; }
.page-title { font-size: clamp(28px, 4.4vw, 40px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; text-wrap: balance; }
.page-sub { margin-top: 12px; color: var(--text-muted); max-width: 56ch; text-wrap: pretty; }
.section-kicker { font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px; }
.arrow-icon { color: var(--text-dim); }

/* ---------- Work page ---------- */
.work-head { padding-top: 60px; }
.work-head .page-title { font-size: 17px; letter-spacing: -0.01em; }
.work-head .page-sub { margin-top: 2px; }
.filter-pills { display: inline-flex; gap: 2px; padding: 3px; margin: 28px 0 40px; background: var(--pill); border: 1px solid var(--pill-border); border-radius: 999px; }
.filter-pill { height: 30px; padding: 0 13px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--text-muted); transition: background-color 0.3s var(--ease), color 0.2s; }
.filter-pill:hover { color: var(--text); }
.filter-pill.active { background: var(--pill-active); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.filter-count { margin-left: 4px; font: 11px var(--font-mono); color: var(--text-dim); }
.work-proof { margin-top: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-top: 12px; border-top: 1px dashed var(--guide); font-size: 13px; }
.work-proof dt { font: 10.5px var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.work-proof dd { margin: 2px 0 0; color: var(--text-muted); }
.lab-link { margin-top: 56px; }
.cover-site-flowoptics { --cover-bg: linear-gradient(135deg, #1b5f78 0%, #4fa3c0 55%, #cfe8ef 100%); }
.cover-site-aritclub { --cover-bg: linear-gradient(135deg, #3a332b 0%, #8c7a62 55%, #e6dccb 100%); }
.cover-site-watches { --cover-bg: linear-gradient(135deg, #1c2430 0%, #8a6a3a 55%, #e9cf9a 100%); }
.cover-site-shortlet { --cover-bg: linear-gradient(135deg, #1d3a2b 0%, #4f7a5c 55%, #d9b77a 100%); }

/* ---------- Automation lab index ---------- */
.lab { width: min(100% - 2 * var(--gutter), var(--col)); }

/* ---------- Contact ---------- */
.contact-head { padding-top: 60px; }
.contact-head h1 { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; }
.contact-head p { color: var(--text-muted); max-width: 48ch; text-wrap: pretty; }
.letter-wrap { position: relative; margin-top: 44px; rotate: -0.5deg; }
.letter-wrap::before {
  content: ""; position: absolute; z-index: 2; top: -13px; left: 9%; width: 96px; height: 28px; rotate: -4deg;
  background: var(--tape); clip-path: polygon(0 0, 4% 50%, 0 100%, 100% 100%, 96% 50%, 100% 0);
}
.letter {
  position: relative; display: grid; gap: 22px; padding: 34px 32px 30px; border-radius: 6px;
  background-color: var(--paper);
  background-image: linear-gradient(transparent 31px, var(--paper-dot) 31px);
  background-size: 100% 32px; background-position: 0 6px;
  box-shadow: 0 0 0 1px var(--pill-border), 0 30px 50px -30px rgba(20, 20, 30, 0.4);
}
.stamp { position: absolute; top: 22px; right: 24px; width: 64px; rotate: 5deg; color: var(--accent); }
.stamp svg { width: 100%; height: auto; overflow: visible; }
.letter-hello { font-family: "Caveat", "Bradley Hand", cursive; font-size: 26px; line-height: 1; color: var(--accent); padding-right: 80px; }
.form-field { display: grid; gap: 6px; }
.form-field label { font: 10.5px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.form-field input, .form-field textarea {
  width: 100%; padding: 11px 13px; font: inherit; color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-field textarea { min-height: 150px; resize: vertical; }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--text-dim); }
.form-field input:hover, .form-field textarea:hover { border-color: var(--text-dim); }
.form-field input:focus-visible, .form-field textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.letter .btn { justify-self: start; border: 0; cursor: pointer; }
.form-note, .form-status { font-size: 12.5px; color: var(--text-muted); }
.form-status { padding: 10px 12px; border-left: 2px solid var(--ok); background: var(--ok-bg); color: var(--ok); border-radius: 0 8px 8px 0; }
.routes { margin-top: 64px; }
.route { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0; border-top: 1px solid var(--line); transition: padding 0.3s var(--ease); }
.route:last-child { border-bottom: 1px solid var(--line); }
.route:hover { padding-left: 8px; }
.route strong { display: block; font-size: 15px; font-weight: 500; }
.route small { display: block; color: var(--text-muted); font-size: 13.5px; overflow-wrap: anywhere; }
.route .ico { width: 14px; height: 14px; color: var(--text-dim); }

@media (max-width: 560px) {
  .work-proof { grid-template-columns: 1fr; gap: 8px; }
  .letter { padding: 30px 20px 24px; }
  .letter-wrap { rotate: 0deg; }
  .stamp { width: 52px; right: 16px; top: 16px; }
}

/* ==========================================================================
   Case-study components (ported from the previous stylesheet)
   ========================================================================== */
/* Automation Lab Page */
.automation-index {
  padding-bottom: 80px;
}

.automation-index-header {
  padding-bottom: 48px;
}

.automation-list {
  border-top: 1px solid var(--border-strong);
}

.automation-list-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  transition: padding 0.25s var(--ease), color 0.2s ease;
}

.automation-list-item:hover {
  padding-right: 8px;
  color: var(--text-main);
}

.automation-list-item:hover .arrow-icon {
  color: var(--text-main);
  transform: translate(2px, -2px);
}

.automation-list-number,
.automation-list-meta {
  color: var(--text-dim);
  font: 12px var(--font-mono);
}

.automation-list-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.automation-list-heading h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.automation-list-status {
  padding: 3px 7px;
  border: 1px solid #a7f3d0;
  border-radius: 4px;
  color: #047857;
  font: 11px var(--font-mono);
  background: #ecfdf5;
}

.automation-list-main p {
  max-width: 620px;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 14px;
}

.automation-list-meta {
  display: inline-block;
  margin-top: 13px;
}

.automation-index-note {
  max-width: 500px;
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--border-strong);
}

.automation-index-note p {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.automation-page {
  padding: 48px 0 80px;
}

.automation-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 72px;
  align-items: end;
  padding: 40px 0 72px;
  border-bottom: 1px solid var(--border);
}

.automation-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--text-dim);
  font: 12px var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.automation-eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.automation-title {
  max-width: 680px;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 600;
  text-wrap: balance;
}

.automation-lede {
  max-width: 570px;
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1.65;
}

.automation-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.automation-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--text-main);
  border-radius: var(--radius-sm);
  background: var(--text-main);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.2s var(--ease), background 0.2s ease, color 0.2s ease;
}

.automation-button:hover {
  transform: translateY(-2px);
  background: #3f3f46;
}

.automation-button:active {
  transform: translateY(0) scale(0.98);
}

.automation-button.secondary {
  background: transparent;
  color: var(--text-main);
}

form button[type="submit"] {
  color: var(--bg) !important;
}

.automation-button.secondary:hover {
  background: var(--bg-subtle);
}

.automation-snapshot {
  padding: 22px 0 0;
  border-top: 1px solid var(--border-strong);
}

.automation-snapshot-label {
  color: var(--text-dim);
  font: 11px var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.automation-snapshot h2 {
  margin-top: 14px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.automation-snapshot p {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.automation-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.48fr);
  gap: 72px;
  padding-top: 64px;
}

.automation-section + .automation-section {
  margin-top: 54px;
}

.automation-section h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.automation-section p {
  max-width: 62ch;
  margin-top: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}

.automation-flow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 24px;
  border: 1px solid var(--border);
  background: var(--border);
}

.automation-step {
  min-height: 150px;
  padding: 18px;
  background: var(--surface);
}

.automation-step-number {
  color: var(--text-dim);
  font: 12px var(--font-mono);
}

.automation-step h3 {
  margin-top: 28px;
  font-size: 15px;
  font-weight: 600;
}

.automation-step p {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.automation-aside {
  align-self: start;
  border-top: 1px solid var(--border-strong);
}

.automation-detail {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.automation-detail dt { color: var(--text-dim); }
.automation-detail dd { color: var(--text-main); text-align: right; }

.automation-note {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

@media (max-width: 768px) {
  .automation-page { padding-top: 24px; }
  .automation-hero, .automation-content { grid-template-columns: 1fr; gap: 42px; }
  .automation-hero { padding: 28px 0 52px; }
  .automation-content { padding-top: 48px; }
}

@media (max-width: 540px) {
  .automation-list-item {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
  }

  .automation-list-heading {
    display: block;
  }

  .automation-list-status {
    display: inline-block;
    margin-top: 8px;
  }

  .automation-flow { grid-template-columns: 1fr; }
  .automation-step { min-height: auto; }
  .automation-step h3 { margin-top: 18px; }
}


/* Interactive Architecture & Data Flow Diagram Component */
.arch-container {
  margin-top: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.arch-tabs {
  display: flex;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.arch-tab {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.arch-tab:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.02);
}

.arch-tab.active {
  color: var(--text-main);
  background: var(--surface);
  border-bottom-color: var(--text-main);
  font-weight: 600;
}

.arch-canvas {
  padding: 28px 24px;
  overflow-x: auto;
}

.arch-node-grid {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.arch-node {
  flex: 1;
  min-width: 190px;
  max-width: 230px;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.arch-node:hover, .arch-node:focus {
  border-color: var(--text-main);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  outline: none;
}

.arch-node.selected {
  border-color: var(--text-main);
  background: var(--bg-subtle);
  box-shadow: 0 0 0 2px var(--text-main);
}

.arch-badge {
  display: inline-block;
  padding: 2px 6px;
  font: 11px var(--font-mono);
  border-radius: 4px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.arch-badge.trigger { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.arch-badge.process { background: #fdf4ff; color: #a21caf; border: 1px solid #f5d0fe; }
.arch-badge.store { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.arch-badge.ai { background: #fff7ed; color: #c2410c; border: 1px solid #ffedd5; }
.arch-badge.tool { background: #f5f3ff; color: #6d28d9; border: 1px solid #ede9fe; }
.arch-badge.action { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

.arch-node h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.arch-node p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0 !important;
}

.arch-connector {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 16px;
  padding: 0 4px;
  user-select: none;
}

.arch-inspector {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 13px;
}

.inspector-title {
  display: block;
  font: 11px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.inspector-desc {
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 !important;
}

@media (max-width: 768px) {
  .arch-node-grid {
    flex-direction: column;
    align-items: stretch;
  }
  .arch-connector {
    text-align: center;
    transform: rotate(90deg);
    padding: 8px 0;
  }
  .arch-node {
    max-width: none;
  }
}



/* ---------- v2 adjustments to the ported components ---------- */
.automation-list-status { border-color: var(--ok-line); color: var(--ok); background: var(--ok-bg); }
.automation-button { border-radius: 999px; }
.automation-button:hover { background: color-mix(in srgb, var(--text) 82%, var(--bg)); }
.automation-title { font-weight: 500; }
[data-theme="dark"] .arch-badge { background: color-mix(in srgb, currentColor 14%, transparent); border-color: color-mix(in srgb, currentColor 32%, transparent); }
[data-theme="dark"] .arch-badge.trigger { color: #8ab4ff; }
[data-theme="dark"] .arch-badge.process { color: #e59cf0; }
[data-theme="dark"] .arch-badge.store { color: #7fd99a; }
[data-theme="dark"] .arch-badge.ai { color: #ffa76b; }
[data-theme="dark"] .arch-badge.tool { color: #b6a0ff; }
[data-theme="dark"] .arch-badge.action { color: #6fdcb0; }
.automation-title { font-size: clamp(32px, 5vw, 48px); letter-spacing: -0.035em; line-height: 1.05; }
.arch-container { border-radius: 16px; overflow: hidden; }
.arch-canvas { overflow-x: visible; }
.arch-node-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; align-items: stretch; }
.arch-node { min-width: 0; max-width: none; }
.arch-node.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.arch-connector { display: none; }
@media (max-width: 540px) { .arch-node-grid { grid-template-columns: 1fr; } }

/* ---------- Case study: real output screenshot ---------- */
.automation-result { padding: 56px 0 60px; border-bottom: 1px solid var(--border); }
.automation-result h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.025em; }
.automation-result > p { max-width: 62ch; margin-top: 14px; color: var(--text-muted); line-height: 1.7; }
.automation-result figure { margin: 34px 0 0; }
.result-frame {
  position: relative; display: block; padding: 10px; border-radius: 14px;
  background: linear-gradient(160deg, #23262e, #15171c);
  box-shadow: 0 0 0 1px var(--line), 0 30px 50px -30px rgba(10, 12, 20, 0.6);
  rotate: -0.4deg; cursor: zoom-in;
  transition: rotate 0.4s var(--ease), translate 0.4s var(--ease);
}
.result-frame:hover, .result-frame:focus-visible { rotate: 0deg; translate: 0 -3px; }
.result-frame::before {
  content: ""; position: absolute; z-index: 1; top: -11px; left: 50%; width: 96px; height: 24px; translate: -50% 0; rotate: 2deg;
  background: var(--tape); clip-path: polygon(0 0, 4% 50%, 0 100%, 100% 100%, 96% 50%, 100% 0);
}
.result-frame img { display: block; width: 100%; height: auto; border-radius: 8px; }
.automation-result figure.result-narrow { width: min(100%, 680px); margin: 48px 0 0 auto; }
.result-narrow .result-frame { rotate: 0.6deg; }
.result-narrow .result-frame::before { left: 30%; rotate: -3deg; }
.result-narrow .result-frame:hover, .result-narrow .result-frame:focus-visible { rotate: 0deg; }
.automation-result figcaption { margin-top: 14px; font: 500 11px var(--font-mono); letter-spacing: 0.02em; color: var(--text-dim); }
@media (max-width: 560px) {
  .automation-result { padding: 40px 0 44px; }
  .result-frame, .result-narrow .result-frame { padding: 6px; rotate: 0deg; }
  .automation-result figure.result-narrow { margin-top: 36px; }
}
