/* ==========================================================================
   Adnan Tech homepage. Light theme only.
   Sections: 1 Tokens · 2 Base · 3 Layout · 4 Buttons · 5 Header · 6 Hero
   7 Stats · 8 Sections · 9 Footer · 10 Responsive
   ========================================================================== */

/* 1. Tokens */
:root {
    --bg: #ffffff;
    --bg-tint: #f4f6f9;
    --ink: #161b26;
    --ink-soft: #3a4352;
    --muted: #5d6675;
    --line: #e1e6ed;
    --accent: #2b3fd6;
    --accent-ink: #1f2fa8;
    --accent-wash: #eceefc;
    --ok: #1c8a5b;

    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(22, 27, 38, .05), 0 12px 32px -12px rgba(22, 27, 38, .14);
    --header-h: 68px;
    --section-y: clamp(64px, 9vw, 120px);
}

/* 2. Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--font-body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; line-height: 1.15; color: var(--ink); }
h3 { font-size: 1.2rem; letter-spacing: -.005em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.sr-only { position: absolute; 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: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); text-decoration: none; }
.skip-link:focus { top: 12px; }

.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* 3. Layout */
.container { width: min(1160px, 100% - 48px); margin-inline: auto; }
.section { padding-block: var(--section-y); }
.section-tint { background: var(--bg-tint); border-block: 1px solid var(--line); }
.section-title { font-size: clamp(1.9rem, 3.4vw, 2.7rem); max-width: 22ch; }
.section-head { margin-bottom: clamp(32px, 5vw, 56px); display: grid; gap: 14px; max-width: 62ch; }
.section-head-row { max-width: none; display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.section-head-row > div { display: grid; gap: 14px; max-width: 62ch; }
.section-foot { margin-top: 40px; }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.split-head { display: grid; gap: 16px; position: sticky; top: calc(var(--header-h) + 32px); }
.prose { color: var(--ink-soft); max-width: 62ch; margin-top: 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font-size: .95rem; color: var(--ink-soft); }
.chips-sm li { padding: 3px 10px; font-size: .8rem; background: var(--bg-tint); }
.tag { font-size: .85rem; font-weight: 600; color: var(--accent-ink); }

.check-list { display: grid; gap: 8px; margin-top: 24px; }
.check-list li { position: relative; padding-left: 28px; color: var(--ink-soft); font-size: .98rem; }
.check-list li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 12px; height: 7px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }

.text-link { font-weight: 600; color: var(--accent-ink); text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; transition: background-size .2s; padding-bottom: 2px; }
.text-link:hover { background-size: 100% 2px; }

.media-fallback { width: 100%; height: 100%; min-height: 160px; display: grid; place-items: center; padding: 16px; text-align: center; color: var(--muted); font-family: var(--font-display); font-size: 1.05rem; background: repeating-linear-gradient(135deg, var(--bg-tint) 0 14px, #eef1f5 14px 28px); }

/* 4. Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 24px; border-radius: var(--radius-sm); border: 1px solid transparent; font: 600 .98rem/1 var(--font-body); text-decoration: none; cursor: pointer; transition: background .2s, border-color .2s, color .2s, transform .2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { background: var(--bg); color: var(--ink); border-color: #c9d0da; }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { padding: 10px 18px; font-size: .92rem; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }

/* 5. Header */
.site-header { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.4) blur(6px); }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; background: var(--ink); color: #fff; border-radius: 8px; font-family: var(--font-display); font-size: 1.1rem; }
.brand-text { font-size: 1.08rem; }
.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav ul { display: flex; gap: 26px; }
.site-nav ul a { text-decoration: none; font-size: .95rem; font-weight: 500; color: var(--ink-soft); padding: 6px 0; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.site-nav ul a:hover { color: var(--ink); border-color: var(--accent); }
.nav-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius-sm); cursor: pointer; position: relative; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { position: absolute; left: 12px; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s, opacity .2s; content: ""; }
.nav-toggle-bars { top: 21px; }
.nav-toggle-bars::before { left: 0; top: -6px; }
.nav-toggle-bars::after { left: 0; top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }

/* 6. Hero */
.hero { padding-block: clamp(48px, 7vw, 96px) clamp(56px, 8vw, 104px); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero h1 { font-size: clamp(2.4rem, 5.2vw, 4rem); max-width: 16ch; }
.lead { margin: 24px 0 32px; font-size: 1.15rem; color: var(--ink-soft); max-width: 52ch; }
.hero-visual { position: relative; padding: 0 0 28px; }
.editor { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.editor-bar { display: flex; align-items: center; gap: 14px; padding: 10px 14px 0; background: var(--bg-tint); border-bottom: 1px solid var(--line); }
.editor-dots { display: flex; gap: 6px; padding-bottom: 10px; }
.editor-dots i { width: 10px; height: 10px; border-radius: 50%; background: #d3d9e2; }
.editor-tabs { display: flex; gap: 2px; overflow: hidden; }
.editor-tab { padding: 7px 14px; font: .78rem/1 var(--font-mono); color: var(--muted); border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; white-space: nowrap; }
.editor-tab.is-active { background: #fff; color: var(--ink); border-color: var(--line); margin-bottom: -1px; }
.editor-code { white-space: normal; margin: 0; padding: 20px 8px 22px; overflow-x: auto; font: .86rem/1.85 var(--font-mono); color: var(--ink-soft); }
.code-line { display: block; white-space: pre; }
.ln { display: inline-block; width: 2.6em; padding-right: 1.2em; text-align: right; color: #a3acb9; user-select: none; }
.tok-kw { color: var(--accent); font-weight: 600; }
.tok-cls { color: #0b7a6b; }
.tok-fn { color: #8a3fb3; }
.tok-var { color: #b34a1f; }
.tok-str { color: #1c8a5b; }
.tok-cm { color: #8b95a5; font-style: italic; }
.badge-float { position: absolute; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); font-size: .85rem; color: var(--ink-soft); }
.badge-float strong { color: var(--ink); }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px #dff3e9; }
.badge-1 { left: -20px; bottom: 0; }
.badge-2 { right: 16px; bottom: 6px; }

/* Single orchestrated moment: the code lines write in once on load. */
.code-line { opacity: 0; animation: write-in .45s ease-out forwards; }
.badge-float { opacity: 0; animation: write-in .5s ease-out 1.1s forwards; }
@keyframes write-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.code-line:nth-child(1){animation-delay:.10s}.code-line:nth-child(2){animation-delay:.18s}.code-line:nth-child(3){animation-delay:.26s}
.code-line:nth-child(4){animation-delay:.34s}.code-line:nth-child(5){animation-delay:.42s}.code-line:nth-child(6){animation-delay:.50s}
.code-line:nth-child(7){animation-delay:.58s}.code-line:nth-child(8){animation-delay:.66s}.code-line:nth-child(9){animation-delay:.74s}
.code-line:nth-child(n+10){animation-delay:.82s}

/* 7. Stats */
.stats { border-block: 1px solid var(--line); background: var(--bg); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { display: flex; flex-direction: column-reverse; gap: 4px; padding: 32px 24px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat dd { font: 600 clamp(2rem, 4vw, 2.9rem)/1 var(--font-display); letter-spacing: -.02em; }
.stat dt { color: var(--muted); font-size: .95rem; }

/* 8. Sections */
.about-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.about-grid .small { margin-top: 24px; }
.principles { display: grid; gap: 0; border-top: 1px solid var(--line); }
.principles li { padding: 22px 0; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.principles p { color: var(--muted); font-size: .98rem; }

.skills-list { display: grid; }
.skill-row { display: grid; grid-template-columns: 200px 1fr; gap: 24px; padding: 22px 0; border-top: 1px solid var(--line); align-items: baseline; }
.skill-row:last-child { border-bottom: 1px solid var(--line); }
.skill-row h3 { font-family: var(--font-body); font-size: .98rem; font-weight: 600; letter-spacing: 0; color: var(--ink-soft); }

.service-list { border-top: 1px solid var(--line); }
.service { padding: 26px 0; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.service h3 a { text-decoration: none; transition: color .2s; }
.service h3 a:hover { color: var(--accent); }
.service p { color: var(--muted); max-width: 54ch; }

.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.project { display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.project:hover { border-color: #c4ccd8; box-shadow: var(--shadow); }
.project-media { aspect-ratio: 16 / 9; background: var(--bg-tint); border-bottom: 1px solid var(--line); overflow: hidden; }
.project-media img { width: 100%; height: 100%; object-fit: cover; }
.project-body { padding: 24px 26px 28px; display: grid; gap: 10px; align-content: start; flex: 1; }
.project-body p:not(.tag) { color: var(--muted); font-size: .98rem; }
.project-body .chips { margin: 6px 0 8px; }
.project-body .text-link { justify-self: start; }
.project-featured { grid-column: 1 / -1; flex-direction: row; }
.project-featured .project-media { flex: 1.35; aspect-ratio: auto; min-height: 320px; border-bottom: 0; border-right: 1px solid var(--line); }
.project-featured .project-body { flex: 1; padding: 40px; align-content: center; }
.project-featured h3 { font-size: 1.7rem; }

.timeline { position: relative; display: grid; gap: 36px; padding-left: 28px; border-left: 2px solid var(--line); }
.timeline-item { position: relative; display: grid; gap: 6px; }
.timeline-item::before { content: ""; position: absolute; left: -35px; top: .45em; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.timeline-date { font: .85rem var(--font-mono); color: var(--accent-ink); }
.timeline-item p:last-child { color: var(--muted); max-width: 54ch; }
.timeline-item h3 .muted { font-weight: 400; }

.quote-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.quote { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; display: grid; gap: 22px; align-content: space-between; }
.quote blockquote { margin: 0; font: 1.12rem/1.6 var(--font-display); color: var(--ink); }
.quote figcaption { display: grid; gap: 2px; font-size: .92rem; }

.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(28px, 5vw, 64px); align-items: center; padding: clamp(24px, 4vw, 48px); border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, #fff, var(--accent-wash) 220%); }
.product + .product { margin-top: 28px; }
.product-body { display: grid; gap: 14px; justify-items: start; }
.product-body h3 { font-size: 2rem; }
.product-tagline { font-weight: 600; color: var(--accent-ink); }
.product-body > p:not(.product-tagline) { color: var(--ink-soft); }
.product-body .check-list { margin: 4px 0 10px; }
.product-media { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--bg-tint); aspect-ratio: 4 / 3; }
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.product:nth-child(even) .product-body { order: 2; }

.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.post { display: grid; gap: 10px; align-content: start; }
.post-media { display: block; aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin-bottom: 8px; background: var(--bg-tint); }
.post-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.post:hover .post-media img { transform: scale(1.03); }
.post-date { font: .82rem var(--font-mono); color: var(--muted); }
.post h3 a { text-decoration: none; }
.post h3 a:hover { color: var(--accent); }
.post p { color: var(--muted); font-size: .96rem; }

.contact-list { display: grid; gap: 14px; margin-top: 16px; }
.contact-list dt { font-size: .85rem; color: var(--muted); }
.contact-list dd a { font-weight: 600; text-decoration: none; color: var(--accent-ink); }
.contact-card, .form { display: grid; gap: 18px; padding: clamp(24px, 4vw, 40px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-tint); justify-items: start; }
.form { justify-items: stretch; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.form input, .form textarea { font: inherit; font-weight: 400; padding: 12px 14px; border: 1px solid #c9d0da; border-radius: var(--radius-sm); background: #fff; color: var(--ink); }
.form input:focus, .form textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-wash); }
.form .btn { justify-self: start; }

.cta { padding-block: clamp(48px, 7vw, 88px); background: var(--accent-wash); border-top: 1px solid #d9ddf7; }
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 32px 56px; flex-wrap: wrap; }
.cta h2 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); }
.cta p { margin-top: 10px; color: var(--ink-soft); max-width: 52ch; }

/* 9. Footer */
.site-footer { background: var(--bg); border-top: 1px solid var(--line); padding-top: clamp(44px, 6vw, 72px); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1.2fr; gap: 40px; padding-bottom: 48px; }
.footer-brand { display: grid; gap: 16px; align-content: start; }
.footer-brand p { color: var(--muted); max-width: 40ch; font-size: .96rem; }
.footer-col h2 { font: 600 .92rem/1 var(--font-body); letter-spacing: 0; margin-bottom: 16px; }
.footer-col ul { display: grid; gap: 8px; font-size: .95rem; color: var(--muted); }
.footer-col a { text-decoration: none; transition: color .2s; }
.footer-col a:hover { color: var(--accent); }
.social-list { display: flex !important; flex-wrap: wrap; gap: 8px 18px !important; margin-top: 18px; }
.footer-bottom { border-top: 1px solid var(--line); padding-block: 22px; font-size: .88rem; color: var(--muted); }

/* 10. Responsive */
@media (max-width: 980px) {
    .hero-grid, .about-grid, .split, .product { grid-template-columns: 1fr; }
    .split-head { position: static; }
    .product:nth-child(even) .product-body { order: 0; }
    .project-featured { flex-direction: column; }
    .project-featured .project-media { min-height: 0; aspect-ratio: 16 / 9; border-right: 0; border-bottom: 1px solid var(--line); }
    .project-featured .project-body { padding: 26px; }
    .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .site-nav { position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 16px; padding: 12px 24px 24px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 16px 24px -16px rgba(22, 27, 38, .2); visibility: hidden; opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s, visibility .2s; }
    .site-nav.is-open { visibility: visible; opacity: 1; transform: none; }
    .site-nav ul { flex-direction: column; gap: 0; }
    .site-nav ul a { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 680px) {
    body { font-size: 16px; }
    .container { width: min(1160px, 100% - 32px); }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
    .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
    .skill-row { grid-template-columns: 1fr; gap: 10px; }
    .project-grid, .post-grid { grid-template-columns: 1fr; }
    .section-head-row { flex-direction: column; align-items: start; }
    .footer-grid { grid-template-columns: 1fr; }
    .badge-1 { left: 8px; }
    .btn-row .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .code-line, .badge-float { opacity: 1; }
}

.browser { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.browser-bar { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--bg-tint); border-bottom: 1px solid var(--line); }
.browser-bar .editor-dots { padding-bottom: 0; }
.browser-url { flex: 1; padding: 6px 14px; background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browser-body { display: grid; grid-template-columns: 150px 1fr; min-height: 300px; }
.mock-nav { padding: 18px 12px; border-right: 1px solid var(--line); background: #fafbfc; display: grid; gap: 4px; align-content: start; font-size: .85rem; color: var(--muted); }
.mock-nav li { padding: 8px 12px; border-radius: var(--radius-sm); }
.mock-nav li.is-active { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
.mock-main { padding: 20px 22px 26px; }
.mock-heading { font: 600 1.25rem/1.2 var(--font-display); margin-bottom: 14px; }
.mock-rows { display: grid; }
.mock-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); animation: write-in .45s ease-out both; }
.mock-row-text { display: grid; font-size: .9rem; line-height: 1.4; }
.mock-row-text span { color: var(--muted); font-size: .82rem; }
.status { padding: 4px 12px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.status-ok { background: #dff3e9; color: #146b45; }
.status-info { background: var(--accent-wash); color: var(--accent-ink); }
.status-warn { background: #fdf0d5; color: #8a5a00; }
.mock-row:nth-child(1) { animation-delay: .15s; }
.mock-row:nth-child(2) { animation-delay: .30s; }
.mock-row:nth-child(3) { animation-delay: .45s; }
.mock-row:nth-child(n+4) { animation-delay: .60s; }

@media (max-width: 680px) {
    .browser-body { grid-template-columns: 1fr; }
    .mock-nav { display: none; }
}