/* Access Gateway — shared styles.
   Mood: a dark, premium security console. One ambient ember glow carries the
   brand; everything else stays quiet. The signature is access STATE — granted
   areas light up (cool mint, "open"), locked areas stay dim and colorless
   ("de-energized"). Allow/deny is what this product does, so the colour says it.
   Display: Space Grotesk · Body: Inter · Labels & keys: Space Mono. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --void:      #09090b;   /* base */
  --void-2:    #0d0d11;
  --surface:   #141419;   /* cards, tiles, panel */
  --surface-2: #1b1b22;   /* inputs, hover */
  --line:      rgba(255,255,255,.08);
  --line-2:    rgba(255,255,255,.15);

  --text:      #f3f2ef;
  --muted:     #9a9aa4;
  --faint:     #61616b;

  --ember:     #ff5331;   /* ambient brand glow, primary focus */
  --ember-2:   #ff8754;

  --pass:      #79f2c0;   /* GRANTED — lit / open */
  --pass-bg:   rgba(121,242,192,.10);
  --pass-line: rgba(121,242,192,.32);

  --lock:      #8b8b95;   /* LOCKED — dim / colourless */
  --danger:    #ff6f56;

  --display: "Space Grotesk", system-ui, sans-serif;
  --sans:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:    "Space Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r:    14px;
  --r-sm: 10px;
  --pad:  clamp(20px, 5vw, 56px);
  --maxw: 1140px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 78% -8%, rgba(255,83,49,.10), transparent 60%),
    radial-gradient(900px 600px at -5% 8%, rgba(255,83,49,.05), transparent 55%),
    var(--void);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

/* fine film grain over everything */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--ember); text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: .92em; color: var(--muted); }

/* ---- system labels ---- */
.eyebrow {
  font-family: var(--mono); font-size: 11px; font-weight: 400;
  letter-spacing: .22em; text-transform: uppercase; color: var(--faint);
}
.path { font-family: var(--mono); font-size: 12px; color: var(--faint); letter-spacing: .02em; }

/* ---- the ember (ambient animated glow) ---- */
.ember { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ember-svg { position: absolute; width: min(120vh, 1000px); height: min(120vh, 1000px); }
.ember-svg.right { right: -16%; top: 50%; transform: translateY(-50%); }
.ember-svg.center { left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* ---- top bar ---- */
.bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 15px var(--pad);
  background: rgba(9,9,11,.72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar .brand { font-family: var(--mono); font-size: 13px; letter-spacing: .04em; color: var(--muted); }
.bar .brand b { color: var(--text); font-weight: 700; }
.bar .spacer { flex: 1; }
.bar .who { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.bar a.link { color: var(--muted); text-decoration: none; font-size: 14px; transition: color .15s ease; }
.bar a.link:hover { color: var(--text); }

/* ---- page shell ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: var(--pad); }

/* ---- hero (landing) ---- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-inner { position: relative; z-index: 1; padding-top: clamp(48px, 9vw, 104px); padding-bottom: clamp(40px, 7vw, 80px); }
.hero .eyebrow { display: block; margin-bottom: 18px; }

.hero-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(40px, 7.2vw, 92px); line-height: .96; letter-spacing: -.035em;
  margin: 0; max-width: 16ch; color: var(--text);
}
.hero-title .glow { color: var(--ember-2); }
.hero-sub { color: var(--muted); font-size: clamp(15px, 1.6vw, 18px); margin: 22px 0 0; max-width: 56ch; }

/* generic small page head (admin, sample apps) */
.head h1 { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 4vw, 44px); letter-spacing: -.025em; margin: 12px 0 8px; }
.head p { color: var(--muted); margin: 0; max-width: 62ch; }
.head .eyebrow { display: block; }

/* ---- resource tiles (the signature) ---- */
.section-label { display: flex; align-items: baseline; gap: 14px; margin: clamp(28px,5vw,44px) 0 18px; }
.section-label .count { font-family: var(--mono); font-size: 12px; color: var(--faint); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.tile {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px 22px 20px;
  text-decoration: none; color: inherit;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
/* a hairline of accent light along the top edge of granted tiles */
.tile.granted::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--pass-line), transparent);
  opacity: .8;
}
.tile.granted:hover {
  transform: translateY(-3px);
  border-color: var(--pass-line);
  background: linear-gradient(180deg, var(--pass-bg), transparent 60%), var(--surface);
}
.tile.granted:focus-visible { outline: 2px solid var(--pass); outline-offset: 3px; }
.tile.locked { opacity: .62; cursor: not-allowed; }

.tile .top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tile h3 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 19px; letter-spacing: -.01em; }
.tile p { margin: 0; color: var(--muted); font-size: 14px; min-height: 2.7em; }
.tile .path { margin-top: 2px; }
/* arrow cue on granted tiles */
.tile.granted h3::after {
  content: "↗"; margin-left: 8px; color: var(--pass);
  display: inline-block; opacity: 0; transform: translate(-3px,3px);
  transition: opacity .18s ease, transform .18s ease;
}
.tile.granted:hover h3::after { opacity: 1; transform: translate(0,0); }

/* the access-state stamp */
.stamp {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .16em;
  padding: 4px 9px; border-radius: 999px; border: 1px solid; white-space: nowrap;
}
.stamp.granted {
  color: var(--pass); border-color: var(--pass-line); background: var(--pass-bg);
  box-shadow: 0 0 18px -6px var(--pass);
}
.stamp.locked { color: var(--lock); border-color: var(--line-2); background: transparent; }

/* ---- gate (login) ---- */
.gate { position: relative; overflow: hidden; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate-inner {
  position: relative; z-index: 1; width: 100%; max-width: var(--maxw);
  display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(32px, 6vw, 80px); align-items: center;
}
.gate-copy .mark { margin-bottom: 22px; }
.gate-copy .hero-title { font-size: clamp(38px, 6vw, 76px); }
.gate-copy .hero-sub { max-width: 44ch; }

.panel {
  width: 100%; max-width: 420px; justify-self: end;
  background: rgba(20,20,25,.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 30px 80px -40px rgba(0,0,0,.9);
}
.mark { font-family: var(--mono); letter-spacing: .22em; font-size: 11px; color: var(--faint); text-transform: uppercase; }
.panel .mark { margin-bottom: 14px; }
.panel h1 { font-family: var(--display); font-weight: 700; font-size: 26px; margin: 0 0 4px; letter-spacing: -.02em; }
.panel .sub { color: var(--muted); font-size: 14px; margin: 0 0 24px; }

/* ---- forms ---- */
label.field { display: block; margin-bottom: 16px; }
label.field .lab { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
input[type=text], input[type=password], select {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 14px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: var(--faint); }
input:focus-visible, select:focus-visible {
  outline: none; border-color: var(--ember);
  box-shadow: 0 0 0 3px rgba(255,83,49,.22);
}
button:focus-visible, a.tile:focus-visible, .bar a:focus-visible {
  outline: 2px solid var(--ember); outline-offset: 2px;
}

/* ---- buttons (white pill primary, à la the brief) ---- */
button {
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 20px; border-radius: 999px; border: 1px solid transparent;
  background: var(--text); color: var(--void); cursor: pointer;
  transition: transform .12s ease, opacity .15s ease, background .15s ease, border-color .15s ease;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
button.full { width: 100%; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line-2); font-weight: 500; }
button.ghost:hover { border-color: var(--text); background: rgba(255,255,255,.04); }
button.small { padding: 6px 12px; font-size: 12.5px; }
button.danger { background: transparent; color: var(--danger); border-color: rgba(255,111,86,.4); }
button.danger:hover { background: rgba(255,111,86,.12); border-color: var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---- inline notices ---- */
.notice { font-size: 13.5px; padding: 11px 14px; border-radius: var(--r-sm); margin: 4px 0 16px; border: 1px solid; }
.notice.err { color: #ffb3a4; background: rgba(255,111,86,.10); border-color: rgba(255,111,86,.35); }
.notice.ok  { color: var(--pass); background: var(--pass-bg); border-color: var(--pass-line); }

/* ---- cards & tables (admin, sample apps) ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.card h2 { font-family: var(--display); font-weight: 500; font-size: 15px; letter-spacing: .01em; margin: 0; padding: 16px 18px; border-bottom: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 18px; font-size: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: rgba(255,255,255,.02); }
td.username { font-family: var(--mono); font-size: 13px; color: var(--text); }

.pill { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .1em; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--faint); }
.pill.on { color: var(--pass); border-color: var(--pass-line); background: var(--pass-bg); }
.pill.off { color: var(--lock); border-color: var(--line-2); background: transparent; }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section { margin-top: clamp(28px, 5vw, 44px); }
.section > .eyebrow { display: block; margin-bottom: 14px; }

/* checkbox group for grants */
.checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.checks label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); }
.checks code { font-size: 12px; color: var(--faint); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ember); }

/* ---- dialog ---- */
dialog {
  border: 1px solid var(--line-2); border-radius: 16px; padding: 0; max-width: 460px; width: 92%;
  background: var(--surface); color: var(--text);
  box-shadow: 0 40px 100px -40px rgba(0,0,0,.95);
}
dialog::backdrop { background: rgba(5,5,7,.66); backdrop-filter: blur(3px); }
dialog .dlg-head { font-family: var(--display); font-weight: 500; padding: 18px 22px; border-bottom: 1px solid var(--line); }
dialog .dlg-body { padding: 22px; }
dialog .dlg-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

.muted { color: var(--muted); }
.center { min-height: 70dvh; display: grid; place-items: center; text-align: center; }
.center .stamp { font-size: 11px; }
.center h1 { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; }

/* ---- responsive ---- */
@media (max-width: 820px) {
  .gate-inner { grid-template-columns: 1fr; }
  .panel { justify-self: stretch; max-width: 440px; margin: 0 auto; }
  .gate-copy { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
