:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --text: #17150f;
  --muted: #6b665b;
  --line: #e2ded4;
  --accent: #d9481f;
  --frame: #1c1b18;
  --tag: #ece8de;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11100e;
    --surface: #1a1916;
    --text: #f2efe7;
    --muted: #a39e92;
    --line: #2b2925;
    --accent: #ff7547;
    --frame: #2d2b27;
    --tag: #23211d;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
}
.mark { font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.social { display: flex; gap: 6px; }
.social a {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.social a:hover { color: var(--text); background: var(--tag); }
.social svg { width: 20px; height: 20px; fill: currentColor; }

/* ---------- Hero ---------- */

.hero { padding-top: clamp(56px, 10vw, 120px); padding-bottom: clamp(48px, 8vw, 96px); }
.hero h1 {
  margin: 0;
  max-width: 17ch;
  font-size: clamp(34px, 6vw, 68px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 700;
}
.lead { max-width: 52ch; margin: 24px 0 0; color: var(--muted); font-size: clamp(17px, 1.6vw, 19px); }
.index {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.index a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-size: 15px;
  transition: border-color 0.15s, background 0.15s;
}
.index a:hover { border-color: var(--text); background: var(--surface); }
.index span { font-family: var(--mono); font-size: 12px; color: var(--accent); }

/* ---------- Projects ---------- */

.project {
  padding-top: clamp(56px, 8vw, 96px);
  padding-bottom: clamp(56px, 8vw, 96px);
  border-top: 1px solid var(--line);
  scroll-margin-top: 8px;
}
.p-intro {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 24px 56px;
  margin-bottom: 40px;
}
.num { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.p-title h2 { margin: 8px 0 6px; font-size: clamp(28px, 3.6vw, 40px); line-height: 1.1; letter-spacing: -0.025em; }
.kind { margin: 0; color: var(--muted); font-size: 15px; }
.p-text > p:first-child { margin-top: 0; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0; padding: 0; }
.tags li { padding: 3px 10px; border-radius: 6px; background: var(--tag); font-size: 13.5px; color: var(--muted); }
.note { margin: 0 0 14px; font-size: 14.5px; color: var(--muted); }
.open {
  display: inline-flex;
  gap: 6px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 1px;
}
.open:hover { color: var(--accent); }

/* Text beside a phone */
.split { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px 64px; align-items: center; }
.split .p-intro { display: block; margin: 0; }
.split .p-text { margin-top: 22px; max-width: 54ch; }
.split.flip .phone { order: -1; }

/* ---------- Device frames ---------- */

.browser {
  border-radius: 14px;
  background: var(--frame);
  padding: 0 6px 6px;
  box-shadow: 0 30px 60px -30px rgba(23, 21, 15, 0.35);
}
.bar { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 10px; }
.bar i { width: 11px; height: 11px; border-radius: 50%; background: #4a4842; }
.bar span {
  margin: 0 auto;
  padding: 3px 16px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #b8b3a8;
  font-size: 12.5px;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}
.screen { position: relative; overflow: hidden; border-radius: 9px; background: #fff; }
.screen iframe { display: block; border: 0; transform-origin: 0 0; }

.phone {
  width: min(380px, 100%);
  height: 760px;
  padding: 12px;
  border-radius: 48px;
  background: var(--frame);
  box-shadow: 0 30px 60px -30px rgba(23, 21, 15, 0.45);
  justify-self: center;
}
.phone iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 37px;
  background: #fff;
}

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

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 32px;
  padding-bottom: 48px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14.5px;
}
.foot-links { display: flex; gap: 18px; }
.foot-links a { text-decoration: none; }
.foot-links a:hover { color: var(--text); }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .p-intro { grid-template-columns: 1fr; margin-bottom: 28px; }
  .split { grid-template-columns: 1fr; }
  .split.flip .phone { order: 0; }
  .split .p-text { max-width: none; }
}

@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .browser { border-radius: 12px; padding: 0 4px 4px; }
  .bar { height: 32px; }
  .bar i { width: 9px; height: 9px; }
  .phone { height: 680px; padding: 9px; border-radius: 40px; }
  .phone iframe { border-radius: 32px; }
}
