/* Shared styles for case studies, writeups, CTF and 404 */
.page-head { padding: clamp(64px, 10vw, 120px) 0 48px; }
.page-head > * + * { margin-top: 24px; }
.back { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; color: var(--muted); text-decoration: none; padding: 8px 0; }
.back:hover { color: var(--accent); }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.meta-grid > div { padding: 20px 0; }
.meta-grid p { margin: 0; }
.meta-grid .v { margin-top: 4px; font-size: 15px; }

.hero-shot { aspect-ratio: 16 / 8; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; position: relative; }
.hero-shot img { width: 100%; height: 100%; object-fit: cover; }
.ph { font-family: var(--mono); font-size: 13px; color: var(--muted); text-align: center; padding: 24px; }
.ph b { display: block; color: var(--text); font-weight: 500; margin-bottom: 4px; }

.cs { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 40px; padding: 64px 0; border-top: 1px solid var(--line); }
@media (max-width: 800px) { .cs { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 48px 0; } }
.cs h2 { margin: 0; font-weight: 500; font-size: 28px; letter-spacing: -0.025em; }
@media (min-width: 801px) { .cs h2 { position: sticky; top: 100px; } }
.cs h2 small { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0; margin-bottom: 8px; font-weight: 400; }
.prose { max-width: 680px; color: var(--text-2); font-size: 17px; line-height: 1.75; }
.prose > * + * { margin-top: 18px; }
.prose p { margin: 0; }
.prose h3 { margin: 32px 0 0; font-size: 20px; font-weight: 500; color: var(--text); letter-spacing: -0.015em; }
.prose ul, .prose ol { padding-left: 20px; margin-bottom: 0; }
.prose li + li { margin-top: 8px; }
.prose strong { color: var(--text); font-weight: 500; }
.prose a { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 4px; }
.prose code { font-family: var(--mono); font-size: .88em; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.prose pre { margin-top: 18px; padding: 18px 20px; background: #0A0A09; color: #D9D5CB; border: 1px solid var(--line-2); border-radius: 12px; overflow-x: auto; font-family: var(--mono); font-size: 14px; line-height: 1.7; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose pre .c { color: #6B675E; } .prose pre .p { color: #E8A33D; }
.todo { color: var(--accent); font-family: var(--mono); font-size: .9em; }
.callout { border: 1px solid var(--line-2); border-left: 2px solid var(--accent); border-radius: 0 12px 12px 0; padding: 16px 20px; background: var(--surface); font-size: 15px; }

/* Architecture flow */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin-top: 24px; }
.flow-step { flex: 1 1 140px; border: 1px solid var(--line-2); border-radius: 12px; padding: 16px; background: var(--surface); min-width: 0; }
.flow-step p { margin: 0; }
.flow-step .t { font-weight: 500; color: var(--text); font-size: 15px; }
.flow-step .d { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 4px; }
.flow-step.hl { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.flow-arrow { align-self: center; color: var(--accent); font-family: var(--mono); }
@media (max-width: 640px) { .flow { flex-direction: column; gap: 6px; } .flow-step { flex: none; padding: 12px 14px; } .flow-arrow { transform: rotate(90deg); align-self: flex-start; margin-left: 20px; line-height: 1; } }

.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; margin-top: 24px; }
.shot { margin: 0; }
.shot .frame { aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot figcaption { margin-top: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); }

.next-proj { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 48px 0 96px; border-top: 1px solid var(--line); text-decoration: none; }
.next-proj .h2 { transition: color .3s ease; }
.next-proj:hover .h2 { color: var(--accent); }

/* Writeups list */
.wu-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.wu-list li { border-bottom: 1px solid var(--line); }
.wu { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 24px; align-items: baseline; padding: 26px 0; text-decoration: none; }
@media (max-width: 640px) { .wu { grid-template-columns: 1fr; gap: 6px; } }
.wu-title { font-size: 22px; font-weight: 500; letter-spacing: -0.02em; transition: color .2s ease; }
.wu:hover .wu-title { color: var(--accent); }
.wu-desc { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filters button { font-family: var(--mono); font-size: 13px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); cursor: pointer; }
.filters button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.diff { font-family: var(--mono); font-size: 11px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.diff.easy { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.diff.medium { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.diff.hard { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }

/* CTF */
.flags { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.flagbox { border: 1px dashed var(--line-2); border-radius: 12px; padding: 16px 14px; text-align: center; font-family: var(--mono); font-size: 12px; color: var(--muted); transition: all .4s var(--ease); }
.flagbox b { display: block; font-size: 22px; font-weight: 500; color: var(--text-2); font-family: var(--sans); margin-bottom: 2px; }
.flagbox.got { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.flagbox.got b { color: var(--accent); }
@media (max-width: 560px) { .flags { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; } .flagbox { padding: 12px 4px; font-size: 10px; } .flagbox b { font-size: 18px; } }
.hints details { border-bottom: 1px solid var(--line); }
.hints summary { cursor: pointer; padding: 18px 0; display: flex; justify-content: space-between; gap: 16px; list-style: none; font-size: 16px; }
.hints summary::-webkit-details-marker { display: none; }
.hints summary::after { content: '+'; font-family: var(--mono); color: var(--muted); }
.hints details[open] summary::after { content: '–'; }
.hints details p { margin: 0 0 18px; color: var(--text-2); }
.board { width: 100%; border-collapse: collapse; font-size: 15px; }
.board th { text-align: left; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); font-weight: 400; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.board td { padding: 14px 0; border-bottom: 1px solid var(--line); }
.board td:first-child { font-family: var(--mono); color: var(--muted); width: 48px; }
.board td:last-child, .board th:last-child { text-align: right; font-family: var(--mono); }
.board tr.me td { color: var(--accent); }
.result { margin-top: 14px; font-family: var(--mono); font-size: 14px; min-height: 1.6em; }
.result.ok { color: var(--ok); } .result.bad { color: var(--err); }

/* 404 */
.nf { min-height: 72vh; display: grid; place-items: center; text-align: center; padding: 64px 0; }
.nf-code { font-size: clamp(120px, 26vw, 320px); font-weight: 500; letter-spacing: -0.07em; line-height: .8; margin: 0; color: transparent; -webkit-text-stroke: 1px var(--line-2); }
.nf-code em { font-family: var(--serif); font-weight: 400; color: var(--accent); -webkit-text-stroke: 0; }

/* Project index */
  .viz { width: 100%; height: 100%; display: grid; place-items: center; font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 24px; text-align: center; }
  /* ERP dashboard */
  .viz-erp { background: var(--surface-2); padding: 7%; }
  .erp { width: 100%; height: 100%; display: grid; grid-template-columns: 18% 1fr; gap: 4%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4%; box-shadow: 0 24px 50px rgba(0,0,0,.25); text-align: left; }
  .erp-side { display: flex; flex-direction: column; gap: 10%; padding-top: 6%; }
  .erp-side i { display: block; height: 7px; border-radius: 4px; background: var(--line-2); }
  .erp-side i:first-child { background: var(--accent); width: 70%; }
  .erp-main { display: grid; grid-template-rows: auto 1fr; gap: 8%; min-width: 0; }
  .erp-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6%; }
  .erp-tiles div { border: 1px solid var(--line); border-radius: 6px; padding: 8% 10%; font-size: 10px; color: var(--muted); }
  .erp-tiles div::after { content: ''; display: block; height: 5px; margin-top: 8px; border-radius: 3px; background: var(--line-2); width: 60%; }
  .erp-chart { display: flex; align-items: flex-end; gap: 5%; border-bottom: 1px solid var(--line); padding: 0 2%; }
  .erp-chart i { flex: 1; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--accent) 35%, var(--line-2)); height: 0; transition: height 1.2s var(--ease); transition-delay: calc(var(--d) * 70ms + .3s); }
  .erp-chart i:nth-child(5) { background: var(--accent); }
  .visible .erp-chart i { height: var(--h); }

  /* SnoozeSOC alert board */
  .viz-soc { background: #08080A; padding: 7%; place-items: stretch; text-align: left; color: #A29E94; }
  .soc { display: flex; flex-direction: column; gap: 8px; font-size: clamp(10px, 1vw, 12px); }
  .soc-head { display: flex; justify-content: space-between; color: #EDEAE2; padding-bottom: 8px; border-bottom: 1px solid #222; margin-bottom: 2px; }
  .soc-head b { font-weight: 400; color: #E8C547; }
  .soc-row { display: grid; grid-template-columns: 3.6em 1fr auto; gap: 10px; padding: 7px 10px; border: 1px solid #1d1d1f; border-radius: 6px; opacity: 0; transform: translateY(8px); transition: opacity .6s ease, transform .6s var(--ease); transition-delay: calc(var(--d) * 160ms + .2s); }
  .visible .soc-row { opacity: 1; transform: none; }
  .soc-row span:last-child { color: #7FB2F0; }
  .soc-z { font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2.5vw, 34px); line-height: 1.1; color: #EDEAE2; margin: auto 0 0; padding-top: 6px; letter-spacing: -0.01em; }
  .soc-z em { color: #E8A33D; }


.proj { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: center; padding: 56px 0; border-top: 1px solid var(--line); text-decoration: none; }
.proj:nth-of-type(even) .proj-media { order: 2; }
@media (max-width: 860px) { .proj { grid-template-columns: minmax(0, 1fr); } .proj:nth-of-type(even) .proj-media { order: 0; } }
.proj-media { aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); position: relative; }
.proj-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease); }
.proj:hover .proj-media img, .proj:hover .proj-media .viz { transform: scale(1.03); }
.proj-media .viz { transition: transform 1s var(--ease); }
.proj-num { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.proj-title { margin: 10px 0 14px; font-weight: 500; font-size: clamp(32px, 4vw, 48px); letter-spacing: -0.035em; line-height: 1.02; transition: color .3s ease; }
.proj:hover .proj-title { color: var(--accent); }
.proj-cta { display: inline-flex; align-items: center; gap: 10px; margin-top: 24px; font-size: 15px; color: var(--text); border-bottom: 1px solid var(--accent); padding-bottom: 4px; }
.proj-cta i { font-style: normal; transition: transform .3s var(--ease); }
.proj:hover .proj-cta i { transform: translateX(5px); }

/* Privacy & terms */
.legal { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: clamp(32px, 6vw, 88px); padding-top: 40px; border-top: 1px solid var(--line); }
@media (max-width: 820px) { .legal { grid-template-columns: minmax(0, 1fr); } }
.legal-toc { position: sticky; top: 100px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 820px) { .legal-toc { position: static; } }
.legal-toc .label { margin-bottom: 10px; }
.legal-toc a { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--text-2); text-decoration: none; padding: 5px 0; transition: color .2s ease, transform .3s var(--ease); }
.legal-toc a:hover { color: var(--accent); transform: translateX(3px); }
.legal-body section { scroll-margin-top: 96px; }
.legal-body section + section { margin-top: 44px; padding-top: 44px; border-top: 1px solid var(--line); }
.legal-body h2 { margin: 0 0 6px; font-family: var(--serif); font-weight: 400; font-size: 34px; letter-spacing: -0.01em; color: var(--text); }
