/* ============================================================
   IRONLOG — Iron-gym editorial design system
   Charcoal / chalk base · oxblood accent · monumental type
   ============================================================ */

:root {
  /* Base ink */
  --ink:        #0E0E10;
  --ink-2:      #131316;
  --panel:      #18181B;
  --panel-2:    #1F1F23;
  --panel-3:    #26262B;

  /* Lines / hairlines */
  --line:        rgba(244, 241, 234, 0.09);
  --line-strong: rgba(244, 241, 234, 0.16);

  /* Chalk + steel */
  --chalk:      #F4F1EA;
  --chalk-2:    #DEDACF;
  --steel:      #908D85;
  --steel-2:    #6A6862;
  --steel-3:    #46443F;

  /* Oxblood accent — the one strong color */
  --ox:         #B0392E;
  --ox-bright:  #C8473A;
  --ox-deep:    #8E2C24;
  --ox-wash:    rgba(176, 57, 46, 0.12);

  /* Calendar status only */
  --gym:        #4A7E58;
  --gym-bright: #5E9A6D;
  --rest:       #9E4039;
  --rest-bright:#B5544C;

  --r-sm: 4px;
  --r:    7px;
  --r-lg: 12px;

  --shadow:    0 18px 50px -22px rgba(0,0,0,0.85);
  --shadow-lg: 0 40px 90px -30px rgba(0,0,0,0.9);

  --maxw: 1240px;

  --font-display: "Anton", "Oswald", sans-serif;
  --font-head:    "Oswald", sans-serif;
  --font-body:    "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Concrete grain + vignette atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.035;
  mix-blend-mode: overlay;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(176,57,46,0.10), transparent 55%),
    radial-gradient(100% 100% at 50% 120%, rgba(0,0,0,0.55), transparent 60%);
}

#root { position: relative; z-index: 2; }

::selection { background: var(--ox); color: var(--chalk); }

/* Scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--steel-3); border-radius: 20px; border: 3px solid var(--ink); }
::-webkit-scrollbar-thumb:hover { background: var(--steel-2); }

/* ---------- Typographic primitives ---------- */
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.01em; line-height: 0.92; }
.head    { font-family: var(--font-head); font-weight: 600; letter-spacing: 0.02em; }
.tnum    { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.eyebrow {
  font-family: var(--font-head);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.34em;
  font-size: 12px;
  color: var(--steel);
}
.eyebrow .tick { color: var(--ox-bright); }

.hairline { height: 1px; background: var(--line); border: 0; width: 100%; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

/* ---------- Section scaffold ---------- */
.section { padding: clamp(64px, 9vw, 128px) 0; position: relative; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 40px; flex-wrap: wrap; }
.section-title {
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 76px);
  line-height: 0.9;
  text-transform: uppercase;
  margin: 8px 0 0;
  letter-spacing: 0.005em;
}
.section-index { font-family: var(--font-head); font-weight: 600; color: var(--ox-bright); letter-spacing: 0.2em; font-size: 13px; }

/* ---------- Reveal on scroll ----------
   Base state is VISIBLE (never gets stuck hidden if JS/anim is frozen).
   The .in class plays a one-shot entrance animation. */
.reveal { opacity: 1; }
.reveal.in { animation: revealIn .8s cubic-bezier(.16,1,.3,1); }
@keyframes revealIn { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .reveal.in { animation: none; } }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-head); font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 13px; border: 1px solid var(--line-strong); background: transparent; color: var(--chalk);
  padding: 12px 20px; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 9px;
  transition: background .2s, border-color .2s, color .2s, transform .12s; user-select: none;
}
.btn:hover { border-color: var(--steel); background: rgba(244,241,234,0.04); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ox); border-color: var(--ox); color: var(--chalk); }
.btn-primary:hover { background: var(--ox-bright); border-color: var(--ox-bright); }
.btn-ghost { border-color: transparent; padding-left: 8px; padding-right: 8px; }
.btn-ghost:hover { background: rgba(244,241,234,0.05); }

/* ---------- Pen / edit affordance ---------- */
.pen {
  --pen-bg: var(--panel-2);
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--pen-bg); border: 1px solid var(--line-strong); color: var(--steel);
  cursor: pointer; transition: all .18s; flex: 0 0 auto;
}
.pen:hover { color: var(--chalk); border-color: var(--ox); background: var(--ox-wash); transform: rotate(-8deg); }
.pen svg { width: 14px; height: 14px; }
.pen.pen-sm { width: 26px; height: 26px; }
.pen.pen-sm svg { width: 12px; height: 12px; }

/* edit-glow on hover of an editable region in admin mode */
.editable { position: relative; }
.admin .editable.hl { outline: 1px dashed transparent; outline-offset: 6px; border-radius: var(--r-sm); transition: outline-color .2s; }
.admin .editable.hl:hover { outline-color: rgba(176,57,46,0.45); }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--ink-2) 100%);
  border: 1px solid var(--line); border-radius: var(--r);
  position: relative;
}
.card-hover { transition: transform .35s cubic-bezier(.16,1,.3,1), border-color .35s, box-shadow .35s; }
.card-hover:hover { transform: translateY(-5px); border-color: var(--line-strong); box-shadow: var(--shadow); }

/* ---------- Tags ---------- */
.tag {
  font-family: var(--font-head); font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 11px; padding: 5px 10px; border-radius: 3px; display: inline-flex; align-items: center; gap: 6px;
}
.tag-gym  { color: var(--gym-bright);  background: rgba(74,126,88,0.14);  border: 1px solid rgba(94,154,109,0.35); }
.tag-rest { color: var(--rest-bright); background: rgba(158,64,57,0.14);  border: 1px solid rgba(181,84,76,0.35); }
.tag-pr   { color: var(--ox-bright);   background: var(--ox-wash);        border: 1px solid rgba(200,71,58,0.4); }

/* ---------- Image placeholder ---------- */
.ph {
  position: relative; overflow: hidden; background: var(--ink-2);
  background-image: repeating-linear-gradient(135deg, rgba(244,241,234,0.04) 0 2px, transparent 2px 11px);
  display: flex; align-items: center; justify-content: center;
}
.ph .ph-label { font-family: var(--font-head); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--steel-2); }
.ph::after { content:""; position:absolute; inset:0; background: radial-gradient(120% 90% at 50% 0%, transparent 40%, rgba(0,0,0,0.45)); }

/* ---------- Modal / sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(6,6,7,0.72); backdrop-filter: blur(4px); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .25s ease; }
.modal { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-lg); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg); animation: pop .3s cubic-bezier(.16,1,.3,1); }
.modal-head { display:flex; align-items:center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.modal-body { padding: 24px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ---------- Inputs ---------- */
.field { display: block; margin-bottom: 16px; }
.field > label { font-family: var(--font-head); font-weight: 600; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--steel); display: block; margin-bottom: 7px; }
.input, .select, .textarea {
  width: 100%; background: var(--ink-2); border: 1px solid var(--line-strong); color: var(--chalk);
  border-radius: var(--r-sm); padding: 11px 13px; font-family: var(--font-body); font-size: 15px; outline: none; transition: border-color .18s, box-shadow .18s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--ox); box-shadow: 0 0 0 3px var(--ox-wash); }
.input.tnum { font-variant-numeric: tabular-nums; }
.textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

/* Focus ring for a11y */
:focus-visible { outline: 2px solid var(--ox-bright); outline-offset: 2px; }
.btn:focus-visible, .pen:focus-visible { outline: 2px solid var(--ox-bright); outline-offset: 3px; }

/* utility */
.muted { color: var(--steel); }
.dim   { color: var(--steel-2); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.grow { flex: 1 1 auto; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }
