/* Profil BBWS Pompengan Jeneberang. Warna diambil dari logo PU (navy #364878, kuning #ffc928). */

@layer base, layout, components;

:root {
  /* token warna mentah */
  --navy-700: #26355e;
  --navy-600: #364878;
  --navy-200: #b9c6ec;
  --yellow-400: #ffc928;
  --ink-light: #142039;
  --ink-dark: #e8edf7;
  --muted-light: #56627a;
  --muted-dark: #a3afc6;
  --bg-light: #ffffff;
  --bg-dark: #0f1626;
  --surface-light: #f3f6fb;
  --surface-dark: #18213a;
  --border-light: #e1e7f1;
  --border-dark: #2a3654;

  /* token semantik; fallback untuk browser tanpa light-dark() */
  --color-text: var(--ink-light);
  --color-muted: var(--muted-light);
  --color-bg: var(--bg-light);
  --color-surface: var(--surface-light);
  --color-border: var(--border-light);
  --color-brand: var(--navy-600);
  --color-brand-strong: var(--navy-700);
  --color-link: var(--navy-600);

  @media (prefers-color-scheme: dark) {
    --color-text: var(--ink-dark);
    --color-muted: var(--muted-dark);
    --color-bg: var(--bg-dark);
    --color-surface: var(--surface-dark);
    --color-border: var(--border-dark);
    --color-brand: var(--navy-200);
    --color-brand-strong: var(--navy-200);
    --color-link: var(--navy-200);
  }

  @supports (color: light-dark(white, black)) {
    --color-text: light-dark(var(--ink-light), var(--ink-dark));
    --color-muted: light-dark(var(--muted-light), var(--muted-dark));
    --color-bg: light-dark(var(--bg-light), var(--bg-dark));
    --color-surface: light-dark(var(--surface-light), var(--surface-dark));
    --color-border: light-dark(var(--border-light), var(--border-dark));
    --color-brand: light-dark(var(--navy-600), var(--navy-200));
    --color-brand-strong: light-dark(var(--navy-700), var(--navy-200));
    --color-link: light-dark(var(--navy-600), var(--navy-200));
  }

  --color-accent: var(--yellow-400);
  --color-on-accent: var(--navy-700);
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 1rem;
  --shadow: 0 1px 2px rgb(15 22 38 / .05), 0 10px 30px rgb(15 22 38 / .07);
  --container: 72rem;
  --gutter: 1rem;
  --header-h: 4.5rem;

  color-scheme: light dark;
  accent-color: var(--color-accent);
}

@layer base {
  html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-h);
    -webkit-text-size-adjust: 100%;
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
  }

  body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--color-text);
    background: var(--color-bg);
  }

  img { max-width: 100%; height: auto; display: block; }

  h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
  p { margin: 0 0 1em; text-wrap: pretty; }

  a { color: var(--color-link); text-underline-offset: .2em; }

  :focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: .25rem;
  }

  ul[role="list"] { list-style: none; margin: 0; padding: 0; }

  .visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
}

@layer layout {
  .container {
    width: min(100% - 2 * var(--gutter), var(--container));
    margin-inline: auto;
  }

  .section { padding-block: clamp(3rem, 2rem + 4vw, 5.5rem); }
  .section-alt { background: var(--color-surface); }

  .section-head {
    max-width: 40rem;
    margin-block-end: 2rem;
    h2 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.25rem); }
    p:last-child { color: var(--color-muted); margin: 0; }
  }
}

@layer components {
  .skip-link {
    position: absolute;
    inset-inline-start: 1rem;
    inset-block-start: -4rem;
    z-index: 100;
    padding: .6rem 1rem;
    border-radius: .5rem;
    background: var(--color-accent);
    color: var(--color-on-accent);
    font-weight: 700;
    &:focus { inset-block-start: 1rem; }
  }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 2.75rem;
    padding: .6rem 1.15rem;
    border-radius: 999px;
    border: 2px solid transparent;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .15s, border-color .15s, color .15s;
  }
  .btn-accent {
    background: var(--color-accent);
    color: var(--color-on-accent);
    &:hover { background: color-mix(in srgb, var(--color-accent), white 25%); }
  }
  .btn-primary {
    background: var(--navy-600);
    color: white;
    &:hover { background: var(--navy-700); }
  }
  .btn-ghost {
    border-color: rgb(255 255 255 / .7);
    color: white;
    &:hover { background: rgb(255 255 255 / .12); }
  }

  .eyebrow {
    margin: 0 0 .5rem;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--color-brand);
  }

  /* header */
  .site-header {
    position: sticky;
    inset-block-start: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--color-bg), transparent 8%);
    backdrop-filter: blur(10px);
    border-block-end: 1px solid var(--color-border);
  }
  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: var(--header-h);
  }
  .brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: inherit;
    text-decoration: none;
    min-width: 0;
    img { border-radius: .6rem; flex: none; }
    span { display: grid; line-height: 1.25; min-width: 0; }
    strong { font-size: 1rem; }
    small { font-size: .75rem; color: var(--color-muted); }
  }
  .site-nav {
    display: flex;
    align-items: center;
    gap: .25rem 1.25rem;
    a:not(.btn) {
      color: inherit;
      font-weight: 600;
      text-decoration: none;
      padding-block: .5rem;
      &:hover { color: var(--color-brand); }
    }
  }
  .nav-toggle {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--color-border);
    border-radius: .75rem;
    background: transparent;
    color: inherit;
    font-size: 1.4rem;
    cursor: pointer;
    &[hidden] { display: none; }
  }

  /* menu HP: tanpa JS menu tetap tampil di bawah logo; dengan JS jadi tombol buka-tutup */
  @media (width < 48rem) {
    .header-inner { flex-wrap: wrap; padding-block: .5rem; }
    .brand small { display: none; }
    .site-nav {
      flex-basis: 100%;
      flex-wrap: wrap;
      padding-block-end: .5rem;
    }
    .js .site-nav {
      display: none;
      flex-direction: column;
      align-items: stretch;
    }
    .js .site-header:has(.nav-toggle[aria-expanded="true"]) .site-nav { display: flex; }
  }
  @media (width >= 48rem) {
    .js .nav-toggle { display: none; }
  }

  /* hero */
  .hero {
    position: relative;
    isolation: isolate;
    color: white;
    padding-block: clamp(4rem, 3rem + 8vw, 8rem);
    background: var(--navy-700);
    overflow: hidden;
  }
  .hero-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(100deg, rgb(25 36 70 / .92) 0%, rgb(38 53 94 / .78) 45%, rgb(38 53 94 / .35) 100%);
  }
  .hero-content { max-width: var(--container); }
  .hero .eyebrow { color: var(--color-accent); }
  .hero h1 {
    font-size: clamp(2.3rem, 1.4rem + 4.5vw, 4.25rem);
    font-weight: 800;
    max-width: 14ch;
  }
  .hero .lead {
    max-width: 38rem;
    font-size: clamp(1rem, .95rem + .4vw, 1.2rem);
    color: rgb(255 255 255 / .88);
  }
  .hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-block-start: 1.75rem; }

  /* aplikasi utama */
  .app-featured {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    border: 1px solid var(--color-border);
    border-radius: calc(var(--radius) * 1.5);
    overflow: hidden;
    background: var(--color-bg);
    box-shadow: var(--shadow);
    margin-block-end: 1.5rem;
    @media (width < 48rem) { grid-template-columns: 1fr; }
  }
  .app-featured-body {
    padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
    > p { color: var(--color-muted); }
  }
  .app-featured-img {
    width: 100%;
    height: 100%;
    min-height: 14rem;
    object-fit: cover;
  }
  .app-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-block-end: 1.25rem;
    img { flex: none; width: 4rem; height: 4rem; }
    h3 { font-size: 1.6rem; margin: 0; }
    p { margin: 0; color: var(--color-muted); font-weight: 600; }
  }
  .app-url {
    margin: .75rem 0 0;
    font-size: .85rem;
    color: var(--color-muted);
    overflow-wrap: anywhere;
  }

  .app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
    gap: 1rem;
  }
  .app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    padding: 1.4rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    transition: border-color .15s, box-shadow .15s, translate .15s;
    > .bi {
      display: inline-grid;
      place-items: center;
      width: 2.75rem;
      height: 2.75rem;
      margin-block-end: 1rem;
      border-radius: .75rem;
      background: color-mix(in srgb, var(--color-accent), transparent 75%);
      color: var(--color-brand-strong);
      font-size: 1.3rem;
    }
    h3 { font-size: 1.1rem; }
    /* seluruh kartu dapat diklik lewat tautan judul */
    h3 a {
      color: inherit;
      text-decoration: none;
      &::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
    }
    p { color: var(--color-muted); font-size: .95rem; }
    &:hover {
      border-color: var(--color-brand);
      box-shadow: var(--shadow);
      translate: 0 -2px;
    }
    &:has(a:focus-visible) { outline: 3px solid var(--color-accent); outline-offset: 2px; }
    h3 a:focus-visible { outline: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    .app-card:hover { translate: none; }
  }
  .app-tag {
    margin-block-start: auto;
    align-self: flex-start;
    padding: .15rem .6rem;
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-muted);
    font-size: .75rem;
    font-weight: 700;
  }

  /* profil */
  .profil {
    h2 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.25rem); }
    > p:last-child { max-width: 46rem; margin: 0; color: var(--color-muted); font-size: 1.05rem; }
  }

  /* kontak */
  .kontak-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
    gap: 1rem;
  }
  .kontak-card {
    padding: 1.4rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    > .bi { font-size: 1.5rem; color: var(--color-brand); }
    h3 { font-size: 1rem; margin-block: .5rem .35rem; }
    p { margin-block-end: .5rem; overflow-wrap: anywhere; }
    .muted { color: var(--color-muted); font-size: .9rem; }
  }

  /* footer */
  .site-footer {
    background: var(--navy-700);
    color: rgb(255 255 255 / .85);
    font-size: .9rem;
  }
  .footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .25rem 2rem;
    padding-block: 1.5rem;
    p { margin: 0; }
  }
}
