/* --------------------
   Base + Theming
   -------------------- */
:root {
  --bg: #ffffff;
  --surface: rgba(255,255,255,0.65);
  --text: #0b0b0c;
  --muted: #505055;
  --border: rgba(0,0,0,0.08);
  --accent: #0a84ff; /* Apple-esque blue */
  --accent-ink: #ffffff;
  --chip: rgba(10,132,255,0.12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e11;
    --surface: rgba(30,32,37,0.55);
    --text: #f4f6f8;
    --muted: #a9adb6;
    --border: rgba(255,255,255,0.08);
    --accent: #0a84ff;
    --accent-ink: #ffffff;
    --chip: rgba(10,132,255,0.18);
  }
}
[data-theme="light"] {
  --bg: #ffffff; --surface: rgba(255,255,255,0.65); --text: #0b0b0c; --muted: #505055; --border: rgba(0,0,0,0.08); --accent: #0a84ff; --accent-ink: #ffffff; --chip: rgba(10,132,255,0.12);
}
[data-theme="dark"] {
  --bg: #0d0e11; --surface: rgba(30,32,37,0.55); --text: #f4f6f8; --muted: #a9adb6; --border: rgba(255,255,255,0.08); --accent: #0a84ff; --accent-ink: #ffffff; --chip: rgba(10,132,255,0.18);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background:
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.muted, .byline, .meta { color: var(--muted); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: min(1100px, 92%); margin-inline: auto; }

/* --------------------
   Header (Apple-like glass)
   -------------------- */
header.site-header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: saturate(150%) blur(14px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; padding: .75rem 0; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: -0.02em; }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background:url('1.png')  no-repeat center; box-shadow: 0 6px 18px rgba(10,132,255,0.28); text-align: center; }
.brand span { font-size: 1.05rem; }

.nav-links { display: flex; align-items: center; justify-content: center; gap: 1.1rem; }
.nav-links a { color: var(--muted); font-weight: 500; padding: .5rem .6rem; border-radius: 10px; }
.nav-links a.active { color: var(--text); background: var(--chip); }
.nav-actions { display: flex; align-items: center; gap: .5rem; }

.search { position: relative;  /* shown on md+ */ }
.search input { width: 340px; max-width: 60vw; border: 1px solid var(--border); border-radius: 14px; padding: .65rem 2.2rem .65rem 2.2rem; background: rgba(127,127,127,0.06); color: var(--text); outline: none; }
.search svg { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); opacity: .7; }

.btn { border: 1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(127,127,127,0.06)); padding: .55rem .85rem; border-radius: 12px; font-weight: 600; transition: transform .2s ease, box-shadow .2s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(0,0,0,.06); }
.theme-toggle { cursor: pointer; }
.hamburger { display: none; border: 1px solid var(--border); padding: .45rem .6rem; border-radius: 10px; }

/* Mobile dropdown menu */
.mobile-menu { display: none; border-top: 1px solid var(--border); }
.mobile-menu.open { display: block; }
.mobile-menu a { display: block; padding: .8rem 0; text-align: center; color: var(--text); }

/* --------------------
   Hero (Medium x Apple)
   -------------------- */
.hero { padding: clamp(2rem, 6vw, 5rem) 0 1rem; }
.hero .eyebrow { color: var(--muted); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.hero h1 { font-size: clamp(2rem, 7vw, 4rem); line-height: 1.02; letter-spacing: -0.02em; margin: .5rem 0 1rem; }
.hero p { color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.15rem); max-width: 62ch; }
.hero .cta { margin-top: 1.25rem; display: flex; gap: .8rem; flex-wrap: wrap; }
.cta .primary { background: var(--accent); color: var(--accent-ink); border: 0; padding: .75rem 1rem; border-radius: 12px; font-weight: 700; }

/* Chips row */
.chips { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.25rem; }
.chip { border: 1px solid var(--border); background: var(--chip); padding: .4rem .6rem; border-radius: 999px; font-weight: 600; color: var(--text); cursor: pointer; user-select: none; }
.chip[aria-pressed="true"] { outline: 2px solid var(--accent); }

/* --------------------
   Featured + Grid
   -------------------- */
.featured { margin-top: 1.8rem; display: grid; grid-template-columns: 1.2fr .8fr; gap: 1rem; }
.feature-card, .card { position: relative; overflow: hidden; border-radius: 22px; border: 1px solid var(--border); background: linear-gradient(180deg, rgba(127,127,127,0.06), rgba(127,127,127,0.03)); transition: transform .2s ease, box-shadow .3s ease; }
.feature-card:hover, .card:hover { transform: translateY(-2px); box-shadow: 0 18px 50px rgba(0,0,0,.08); }
.feature-media { aspect-ratio: 16/9; background: linear-gradient(135deg, #111, #222); }
.feature-body { padding: 1rem 1.1rem 1.2rem; }
.feature-body h3 { font-size: clamp(1.3rem, 2.8vw, 1.8rem); margin: .2rem 0 .5rem; }

.meta { display: flex; gap: .6rem; align-items: center; font-size: .95rem; flex-wrap: wrap; }
.badge { padding: .25rem .5rem; border-radius: 999px; background: var(--chip); color: var(--text); font-weight: 700; font-size: .75rem; }

.grid { margin-top: 1rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card .media { aspect-ratio: 16/10; background: linear-gradient(135deg, #0a84ff22, #a78bfa22); }
.card .body { padding: .9rem 1rem 1.1rem; }
.card h4 { margin: 0 0 .45rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: .98rem; }

.load-more { display: block; margin: 1.2rem auto 0; }

/* --------------------
   Article Reader (overlay)
   -------------------- */
.reader-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.36); display: none; z-index: 200; }
.reader { position: fixed; inset: 2% auto auto 50%; transform: translateX(-50%); width: min(860px, 92%); max-height: 94vh; overflow: auto; background: var(--bg); border-radius: 22px; border: 1px solid var(--border); box-shadow: 0 30px 100px rgba(0,0,0,.25); display: none; z-index: 201; }
.reader header { position: sticky; top: 0; backdrop-filter: blur(14px); background: var(--surface); border-bottom: 1px solid var(--border); padding: .85rem 1rem; display: flex; align-items: center; gap: .6rem; }
.reader .content { padding: 1rem 1.2rem 2rem; }
.reader h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: .2rem 0 .6rem; letter-spacing: -0.02em; }
.reader .byline { margin-bottom: 1.2rem; }
.reader .prose p { line-height: 1.68; font-size: 1.08rem; margin: 1rem 0; }
.reader .prose h2 { font-size: 1.35rem; margin: 1.4rem 0 .6rem; }
.reader .prose pre { background: #0b0b0c; color: #f8f8f8; padding: .9rem; border-radius: 14px; overflow: auto; }

/* --------------------
   Footer
   -------------------- */
footer { margin-top: 2.2rem; padding: 2rem 0 3rem; border-top: 1px solid var(--border); color: var(--muted); }

/* --------------------
   Responsive
   -------------------- */
@media (max-width: 1000px) {
  .search { display: block; }
  .featured { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .nav { grid-template-columns: auto auto auto; }
  .nav-links { display: none; }
  .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .search input { width: 60vw; }
  .grid { grid-template-columns: 1fr; }
  .hero { padding-top: 1.2rem; }
  .mobile-menu a { background: var(--surface); border-bottom: 1px solid var(--border); border-radius: 0; }
}

/* --- Tutorial page layout tweaks (Hello World v2) --- */
.tutorial-article {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.75rem 1.75rem 2.5rem;
}
@media (max-width: 640px) {
  .tutorial-article {
    padding-inline: 1.1rem;
  }
}

/* --- Code blocks --- */
.tutorial-article pre {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 1.25rem 0;
}

/* Dark mode variant */
[data-theme="dark"] .tutorial-article pre {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Remove extra background on <code> inside <pre> */
.tutorial-article pre code {
  background: none;
  padding: 0;
}

/* Inline code inside paragraphs, lists, etc. */
.tutorial-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
}

[data-theme="dark"] .tutorial-article code {
  background: rgba(255, 255, 255, 0.08);
}

