/* Home page (index.html). Section order follows a learner's path: the idea
   with the judge at work, the levels, real contests, the other tools. */

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero { padding: clamp(28px, 5vw, 64px) 0 clamp(48px, 7vw, 88px); }
.hero-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.hero h1 { font-size: clamp(44px, 5.8vw, 88px); line-height: 0.96; letter-spacing: -0.05em; font-weight: 800; max-width: 11ch; }
.hero h1 code { font: inherit; font-family: var(--mono); font-weight: 650; letter-spacing: -0.07em; background: none; padding: 0; color: var(--accent); }
.lead { margin-top: 26px; max-width: 40ch; font-size: clamp(18px, 1.4vw, 21px); line-height: 1.55; color: var(--text2); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.cta-note { margin-top: 0.8rem; font-size: 0.92rem; min-height: 1px; }
.facts { display: flex; flex-wrap: wrap; gap: 14px 40px; margin: 44px 0 0; padding-top: 22px; border-top: 1px solid var(--border); }
.facts div { display: flex; flex-direction: column-reverse; }
.facts dt { color: var(--text3); font-size: 14px; }
.facts dd { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }

/* the judge example: an editor above, the tests and the verdict below */
.judge { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg2); box-shadow: var(--shadow); }
.editor { background: #110d0b; min-width: 0; }
.editor-head { display: flex; justify-content: space-between; padding: 11px 18px; border-bottom: 1px solid #2e241d; color: #a8977f; font: 13px var(--mono); }
#demoCode { margin: 0; padding: 14px 0 16px; font: 400 14px/1.7 var(--mono); font-variant-ligatures: none; color: #eadfca; overflow-x: auto; }
#demoCode .line { display: block; padding: 0 18px; white-space: pre; }
#demoCode .line.hl { background: rgba(219, 164, 58, 0.11); box-shadow: 3px 0 0 var(--gold) inset; }
#demoCode .ins { background: rgba(134, 185, 111, 0.22); color: #d9f0c9; }
#demoCode .caret { display: inline-block; width: 2px; height: 1.15em; vertical-align: -0.2em; background: var(--gold); animation: blink 1s steps(2) infinite; }
#demoCode .ln { color: #6e5f50; user-select: none; display: inline-block; width: 2.6ch; text-align: right; margin-right: 1.4ch; }
#demoCode .tk-kw { color: #e9b552; } #demoCode .tk-ty { color: #9fc0db; } #demoCode .tk-num { color: #e08d78; }
#demoCode .tk-str { color: #a9c98f; } #demoCode .tk-pp { color: #d68fb4; }
@keyframes blink { 50% { opacity: 0; } }
.judge-side { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px; min-width: 0; }
.judge-problem { font-weight: 650; }
.judge-problem .num { color: var(--text3); font-weight: 500; margin-right: 4px; }
.tests.big { gap: 4px; }
.tests.big .t { width: 17px; height: 17px; }
.judge-result { min-height: 52px; }
.judge-result .verdict { font-size: 19px; }
.judge-result p + p { margin-top: 4px; }
.judge-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Sections ───────────────────────────────────────────────────────────── */
.section { padding: clamp(64px, 8.5vw, 112px) 0; }
.section-alt { background: var(--bg2); border-block: 1px solid var(--border); }
.section-head { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 24px 56px; align-items: end; margin-bottom: clamp(32px, 4vw, 52px); }
.section-head h2 { font-size: clamp(36px, 4.4vw, 62px); line-height: 1; letter-spacing: -0.045em; font-weight: 780; max-width: 13ch; }
.section-head p { color: var(--text2); max-width: 46ch; }
.more { margin-top: 36px; }

/* ── Levels ─────────────────────────────────────────────────────────────── */
.levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 28px; }
.lv { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.lv:hover { text-decoration: none; }
.lv:hover .lv-name { color: var(--link); }
.lv-n { font: 700 1.3rem var(--mono); color: var(--text3); letter-spacing: -0.04em; }
.lv-name { font-weight: 650; line-height: 1.25; transition: color 0.15s; }
.lv-count { color: var(--text3); font-size: 0.88rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Contests ───────────────────────────────────────────────────────────── */
.contest-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 56px; }
.contest-group h3 { font-size: 15px; font-weight: 650; color: var(--text3); letter-spacing: 0; padding-bottom: 10px; border-bottom: 1px solid var(--border2); }
.contest { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.contest:hover { text-decoration: none; }
.contest:hover .c-title { color: var(--link); }
.c-title { font-weight: 600; transition: color 0.15s; }
.c-meta { color: var(--text3); font-size: 14px; }
.c-go { color: var(--text3); font-size: 14px; white-space: nowrap; }

/* ── Tools ──────────────────────────────────────────────────────────────── */
.tools { display: grid; gap: clamp(48px, 7vw, 88px); }
.tool { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.tool:nth-of-type(2) .tool-text { order: 2; }
.tool h3, .tool-list h3 { font-size: clamp(26px, 2.6vw, 36px); letter-spacing: -0.035em; line-height: 1.08; }
.tool p { color: var(--text2); margin: 14px 0 24px; max-width: 42ch; }
.sim, .exam { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 22px; }
.sim { display: grid; gap: 18px; }
.sim-code { font: 14px/1.7 var(--mono); color: var(--text2); }
.sim-hl { display: inline-block; background: rgba(219, 164, 58, 0.14); box-shadow: 3px 0 0 var(--gold) inset; color: var(--text); padding-right: 8px; }
.sim-array { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 20px; }
.cell { position: relative; width: 46px; height: 46px; display: grid; place-items: center; font: 600 16px var(--mono); background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius-sm); }
.cell small { position: absolute; top: -22px; left: 50%; translate: -50% 0; font: 700 12px var(--mono); color: var(--gold); }
.cell.ptr { border-color: var(--gold); }
.cell.done { opacity: 0.45; }
.cell.hit { border-color: var(--success); color: var(--success); }
.sim-vars { display: flex; gap: 20px; font: 14px var(--mono); color: var(--text3); }
.sim-vars b { color: var(--text); font-weight: 600; }
.exam { padding: 0; overflow: hidden; }
.exam-bar { display: flex; justify-content: space-between; padding: 12px 16px; background: var(--bg3); border-bottom: 1px solid var(--border); font-weight: 600; }
.exam-bar .num { font-family: var(--mono); color: var(--warn); }
.exam-body { padding: 18px 16px; display: grid; gap: 12px; }
.exam-row { display: flex; align-items: center; gap: 10px; color: var(--text2); }
.rec { width: 10px; height: 10px; background: var(--error); animation: rec 1.6s ease-in-out infinite; }
@keyframes rec { 50% { opacity: 0.35; } }
.exam-row.locked::before { content: ''; width: 10px; height: 10px; border: 2px solid var(--text3); }
.tool-list { list-style: none; margin: 0; padding: 32px 0 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.tool-list h3 { font-size: 20px; letter-spacing: -0.02em; }
.tool-list p { color: var(--text2); margin-top: 8px; font-size: 16px; }

/* ── Closing ────────────────────────────────────────────────────────────── */
.closing { padding: clamp(64px, 9vw, 112px) 0; text-align: center; }
.closing h2 { font-size: clamp(40px, 5.4vw, 76px); letter-spacing: -0.05em; line-height: 1; }
.closing p { color: var(--text2); margin-top: 18px; }
.closing .cta { justify-content: center; }
.site-foot { margin-top: 0; }

/* ── Smaller screens ────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .levels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .hero-in, .section-head, .tool, .contest-groups { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { max-width: 12ch; }
  .levels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool:nth-of-type(2) .tool-text { order: 0; }
  .tool-list { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .facts { margin-top: 32px; }
}
@media (max-width: 600px) {
  .levels { grid-template-columns: minmax(0, 1fr); }
  .facts { gap: 12px 26px; }
  .facts dd { font-size: 24px; }
  .tests.big .t { width: 15px; height: 15px; }
  .cell { width: 38px; height: 38px; font-size: 14px; }
}
