/* ==========================================================================
   Ata ur Rahman Shahid — site styles
   Mobile first. Colors are tokens. The site is dark-only, so it looks
   the same on every device, whatever the phone or browser theme.
   ========================================================================== */

:root {
  /* Dark-only: browsers use dark form controls and scrollbars, and never
     apply their own automatic darkening on top. */
  color-scheme: dark;

  --bg: #111315;
  --surface: #181b1e;
  --text: #e9ebee;
  --muted: #a4abb3;
  --border: #2b3035;
  --accent: #5ec2bd;
  --accent-hover: #8ad8d4;
  --accent-soft: #15302f;
  --on-accent: #0b1414;

  /* Data visuals in case studies (css/case-visuals.css). */
  --negative: #e58a73;
  --negative-soft: #3a211b;
  --estimate: #e0b35a;
  --estimate-soft: #352a14;
  --fill: #1f2428;
  --positive: #7bc896;
  --positive-soft: #1a2e22;
  --dim: #7e868e;
  --on-estimate: #1e1804;

  --todo-bg: #3a2f0b;
  --todo-border: #d8a92a;
  --todo-text: #f6df9e;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --measure: 42rem;
  --wide: 68rem;
  --gutter: 1rem;
  --radius: 8px;
}

@media (min-width: 640px) {
  :root { --gutter: 2rem; }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
}

h1, h2, h3 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); font-weight: 650; }
h2 { font-size: clamp(1.5rem, 1.25rem + 1.2vw, 2rem); font-weight: 650; }
h3 { font-size: 1.125rem; font-weight: 600; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }

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

/* Sections focused by a section link (js/main.js) don't need an outline. */
[tabindex="-1"]:focus { outline: none; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius);
}
.skip-link:focus { top: 0.75rem; color: var(--on-accent); }

.container {
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.prose { max-width: var(--measure); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.lead {
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.1875rem);
  color: var(--text);
}

/* ---------- Header & navigation ---------- */

.site-header { border-bottom: 1px solid var(--border); }

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1rem;
}

.brand {
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--accent); }

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding-block: 0.25rem;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.site-nav .nav-email {
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.site-nav .nav-email:hover {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---------- Buttons & link rows ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 2rem;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

/* Links with a logo before the label (LinkedIn, GitHub). The label stays visible. */
.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
}
.icon {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  fill: currentColor;
}

.button--secondary {
  background: transparent;
  color: var(--accent);
}
.button--secondary:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ---------- Sections ---------- */

.hero { padding-block: 3.5rem 4rem; }
.hero h1 { max-width: 20ch; margin-bottom: 1.5rem; }
.hero-note { max-width: var(--measure); color: var(--muted); }
.hero .lead { max-width: var(--measure); }

.section {
  padding-block: 3.5rem;
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .hero { padding-block: 6rem 5.5rem; }
  .section { padding-block: 5rem; }
}

.section-intro { max-width: var(--measure); margin-bottom: 2.5rem; }

/* Focus areas */
.areas {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.75rem 3rem;
}
@media (min-width: 640px) {
  .areas { grid-template-columns: repeat(2, 1fr); }
}
.areas li {
  border-top: 2px solid var(--accent);
  padding-top: 1rem;
}
.areas h3 { margin-bottom: 0.4rem; }
.areas p { color: var(--muted); }

/* Case study cards */
.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}
/* Only cards that link to a case study get the hover highlight. */
.card:has(.card-link):hover,
.card:focus-within { border-color: var(--accent); }
.card p { color: var(--muted); font-size: 1rem; }

.card-link {
  margin-top: auto;
  padding-top: 1rem;
  font-weight: 600;
}
/* Makes the whole card clickable while keeping one real link. */
.card-link a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.card-link a:focus-visible { outline: none; }
.card-link a:focus-visible::after { outline: 3px solid var(--accent); outline-offset: 3px; }

.tags {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tags li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
}

.note {
  font-size: 0.9375rem;
  color: var(--muted);
}

/* Approach points */
.principles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem 2.5rem;
}
@media (min-width: 768px) {
  .principles { grid-template-columns: repeat(3, 1fr); }
}
.principles h3 {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.principles p { color: var(--muted); }

/* Contact */
.contact-email {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  color: var(--muted);
  margin-top: 1rem;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  font-size: 0.9375rem;
  color: var(--muted);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

/* ---------- About page ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: var(--measure);
}
.timeline li {
  padding-block: 1rem;
  border-top: 1px solid var(--border);
}
.timeline li:last-child { border-bottom: 1px solid var(--border); }
.timeline .role { font-weight: 600; margin: 0; }
.timeline .meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
}

/* ---------- Case study pages ---------- */

.case-header { padding-block: 2.5rem 3rem; }
@media (min-width: 768px) {
  .case-header { padding-block: 3.5rem 4rem; }
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.9375rem;
}

.case-meta {
  display: grid;
  gap: 1rem 2rem;
  margin: 2rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}
.case-meta dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.case-meta dd { margin: 0.2rem 0 0; font-size: 0.9375rem; }

.case-section {
  padding-block: 2.5rem;
  border-top: 1px solid var(--border);
}
@media (min-width: 768px) {
  .case-section { padding-block: 3rem; }
}
/* Keep the divider full width while the text keeps a readable measure. */
.case-section.prose { max-width: none; }
.case-section.prose > * { max-width: var(--measure); }

.case-header .note { margin-top: 1.5rem; }

.case-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}
.case-section h3 { margin-top: 1.5rem; margin-bottom: 0.35rem; }
/* :where() keeps these low-specificity so diagram and tag lists override them. */
:where(.case-section) ul, :where(.case-section) ol { padding-left: 1.25rem; }
:where(.case-section) li + li { margin-top: 0.4rem; }

.case-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2.5rem;
  border-top: 1px solid var(--border);
}

/* Flow diagram: vertical on phones, horizontal on wide screens. */
.diagram {
  margin: 2rem 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.diagram figcaption {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.flow > li {
  position: relative;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--bg);
}
.flow > li + li { margin-top: 32px; }
.flow > li + li::before {
  content: "";
  position: absolute;
  left: 24px;
  top: -28px;
  width: 2px;
  height: 20px;
  background: var(--muted);
}
.flow > li + li::after {
  content: "";
  position: absolute;
  left: 19px;
  top: -9px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--muted);
}
.flow-label {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
}
.flow-note {
  display: block;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 0.15rem;
}
.flow-sources {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.flow-sources li {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

@media (min-width: 960px) {
  .flow { flex-direction: row; align-items: stretch; }
  .flow > li { flex: 1 1 0; min-width: 0; }
  .flow > li + li { margin-top: 0; margin-left: 32px; }
  .flow > li + li::before {
    left: -28px;
    top: 50%;
    width: 20px;
    height: 2px;
  }
  .flow > li + li::after {
    left: -9px;
    top: calc(50% - 5px);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 7px solid var(--muted);
    border-right: 0;
  }
}

/* Screenshot slot. Replace the placeholder with an <img> inside the figure. */
.shot { margin: 2rem 0; }
.shot img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.shot figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: var(--measure);
}

/* ---------- Phones ----------
   Narrow screens: one-row navigation, full-width buttons, roomier tap targets. */

@media (max-width: 479px) {
  .site-header .container { padding-block: 0.5rem; }
  .brand { display: inline-block; padding-block: 0.6rem; }
  .prose p > a:only-child,
  .contact-email a { display: inline-block; padding-block: 0.6rem; }
  .contact-email { margin-top: 0.25rem; }
  .site-nav { width: 100%; }
  .site-nav ul {
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
    font-size: 0.9375rem;
  }
  .site-nav a { display: inline-block; padding-block: 0.6rem; }
  .site-nav .nav-email { padding: 0.4rem 0.85rem; }

  .hero { padding-block: 2.5rem 3rem; }
  .section { padding-block: 3rem; }

  .actions { gap: 0.75rem 1.5rem; }
  .actions .button {
    flex: 1 1 100%;
    justify-content: center;
    text-align: center;
  }
  .actions > a:not(.button) { padding-block: 0.5rem; }

  .card { padding: 1.25rem; }
  .site-footer ul { gap: 0.25rem 1.25rem; }
  .site-footer ul a { display: inline-flex; padding-block: 0.5rem; }
}

/* ---------- Placeholders (remove once filled in) ----------
   Anything with .todo or .todo-block still needs a fact from Ata.
   Search the project for "TODO" to find them all. */

.todo {
  background: var(--todo-bg);
  color: var(--todo-text);
  outline: 1px dashed var(--todo-border);
  outline-offset: 1px;
  border-radius: 2px;
  padding: 0 0.2em;
}

.todo-block {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  background: var(--todo-bg);
  color: var(--todo-text);
  border: 1px dashed var(--todo-border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
}
.todo-block::before {
  content: "To fill in";
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.todo-block ul { margin: 0.5rem 0 0; }

.shot-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  max-width: 48rem;
  padding: 1.5rem;
  text-align: center;
  background: var(--todo-bg);
  color: var(--todo-text);
  border: 1px dashed var(--todo-border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

.accent-text { color: var(--accent); }

/* ---------- Case study "Key decisions and results" and related links ---------- */

.kdr {
  margin: 1.75rem 0 0;
  padding: 1.25rem;
  max-width: 60rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
@media (min-width: 640px) { .kdr { padding: 1.5rem 1.75rem; } }
.kdr-title {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.kdr-grid { display: grid; gap: 1.25rem 2.5rem; }
@media (min-width: 768px) { .kdr-grid { grid-template-columns: 3fr 2fr; } }
.kdr h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.kdr ul { margin: 0; padding-left: 1.1rem; }
.kdr li { font-size: 0.95rem; line-height: 1.5; color: var(--muted); }
.kdr li + li { margin-top: 0.45rem; }

.related {
  max-width: var(--measure);
  margin: 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--muted);
}

/* Homepage: tools line under the focus areas */
.tools-line { margin-top: 2.5rem; max-width: var(--measure); color: var(--muted); }
.tools-line .eyebrow { display: block; margin-bottom: 0.35rem; }
