/* ==========================================================================
   daniyal.md — shared base
   Reset, page shell, the paper bloom, and the editor chrome rails. Everything
   here is used by every page. Page-specific styles live in landing.css and
   daily-log.css.

   Every value resolves to a design-system token. No raw hex, no one-off
   durations, no easing curves that aren't in effects.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* Reserves the scrollbar gutter on every page, so moving between the landing
   page (no scroll) and the daily log (scrolls) doesn't jump the centred column
   sideways. A no-op on platforms with overlay scrollbars. */
html { scrollbar-gutter: stable; }

body {
  background: var(--paper);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4,
p, ul, ol, figure { margin: 0; }

ul, ol { padding: 0; list-style: none; }

::selection {
  background: var(--accent-green-soft);
  color: var(--ink-900);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   2. Page shell
   Rows: top chrome / content / bottom chrome. The content row takes the
   remaining height, so a short page stays optically centred and a long one
   scrolls, with no magic numbers either way.
   -------------------------------------------------------------------------- */

.page {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100%;
  min-height: 100svh;
  isolation: isolate;
}

/* The landing page inserts a centred action row between content and footer. */
.page--landing { grid-template-rows: auto 1fr auto auto; }

/* The one soft surface on the site. It is a paper-to-paper bloom — the same
   warm hue at two lightness steps — so it reads as light falling on stock,
   not as a colour gradient. It breathes on a 24s cycle, slow enough that you
   register it as depth rather than as motion. */
.page__bloom {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(
      58% 52% at 50% 40%,
      var(--paper-raised) 0%,
      rgba(252, 251, 247, 0) 70%
    );
  animation: bloom-breathe 24s var(--ease-standard) infinite;
  will-change: opacity, transform;
}

@keyframes bloom-breathe {
  0%, 100% { opacity: 0.7;  transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.05); }
}

/* --------------------------------------------------------------------------
   3. Chrome — editor-style metadata rails, top and bottom
   -------------------------------------------------------------------------- */

.chrome {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-8);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  line-height: 1;
}

/* Path and status sit left, version and contact right — top and bottom rails
   mirror each other, the way editor chrome does. */
.chrome--top,
.chrome--bottom { justify-content: space-between; }

.chrome--bottom { border-top: 1px solid var(--border-hairline); }

.path,
.status,
.contact,
.version { display: inline-flex; align-items: center; gap: 6px; }

.path__seg    { color: var(--ink-300); }
.path__sep    { color: var(--ink-150); }
.path__seg--current { color: var(--ink-500); }

.status__key  { color: var(--ink-300); }
.contact__key { color: var(--ink-300); }

/* Status pill, borrowed from the design system's Badge in the green tone. */
.status__value {
  padding: 3px 8px;
  border: 1px solid var(--accent-green-soft);
  border-radius: var(--radius-pill);
  background: var(--accent-green-soft);
  color: var(--accent-green-strong);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.version { color: var(--ink-300); }

/* --ink-700 makes the address the darkest thing in the rail, so it is
   unmistakably findable, while still sitting well below the ink-900 status
   line in the hierarchy. The hairline underline carries the affordance so it
   never depends on colour alone. */
.contact__link {
  /* 12px of type is a 12px tap target. The padding grows the hit area past the
     24px WCAG 2.5.8 floor and the negative margin gives the space back to the
     layout, so nothing moves. */
  display: inline-block;
  padding-block: var(--space-2);
  margin-block: calc(var(--space-2) * -1);

  color: var(--ink-700);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition:
    color var(--duration-base) var(--ease-standard),
    text-decoration-color var(--duration-base) var(--ease-standard);
}

.contact__link:hover {
  color: var(--accent-green);
  text-decoration-color: var(--accent-green);
}

/* Hover states darken one step and never fill — the system's rule. */
.path,
.version,
.path__seg,
.path__sep {
  transition: color var(--duration-base) var(--ease-standard);
}

.path:hover .path__seg,
.path:hover .path__seg--current { color: var(--ink-500); }
.path:hover .path__sep          { color: var(--ink-300); }
.version:hover                  { color: var(--ink-500); }

/* The breadcrumb segment that walks back up the tree. */
.path__link {
  color: var(--ink-300);
  text-decoration: none;
  transition: color var(--duration-base) var(--ease-standard);
}

.path__link:hover { color: var(--accent-green); }

/* --------------------------------------------------------------------------
   4. Button
   Shared: the landing page's Daily Log entry point and the daily log's series
   link. Built on the design system's Button spec at size=lg.
   -------------------------------------------------------------------------- */

.log-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  color: var(--ink-700);
  text-decoration: none;
  overflow: hidden;                        /* clips the sweep to the radius */
  transition:
    color var(--duration-base) var(--ease-standard),
    border-color var(--duration-base) var(--ease-standard);

  /* The aliveness cue. A green ambient glow at ~7–13% alpha, breathing over
     5s. Shallow enough that you notice it without being able to point at it. */
  animation: log-button-glow 5s var(--ease-standard) infinite;
}

@keyframes log-button-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 107, 69, 0.00), 0 0 14px 0 rgba(47, 107, 69, 0.07); }
  50%      { box-shadow: 0 0 0 0 rgba(47, 107, 69, 0.00), 0 0 22px 0 rgba(47, 107, 69, 0.13); }
}

/* Hover darkens the border one step and shifts text colour — the system's
   rule. No fill, no lift, no scale. */
.log-button:hover {
  color: var(--ink-900);
  border-color: var(--ink-300);
}

.log-button:active { color: var(--accent-green-strong); }

.log-button__icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--ink-300);
  transition: color var(--duration-base) var(--ease-standard);
}

.log-button:hover .log-button__icon { color: var(--accent-green); }

.log-button__label { display: inline-block; }

/* The same left-origin scan gesture as the landing page's build bar, reused as
   the hover signal: a hairline runs the width of the button along its bottom
   edge. */
.log-button__sweep {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent-green);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--duration-slow) var(--ease-out);
}

.log-button:hover .log-button__sweep,
.log-button:focus-visible .log-button__sweep { transform: scaleX(1); }

/* --------------------------------------------------------------------------
   5. Reveal primitive
   JS (landing) or a CSS animation (daily log) flips these to .is-in. Keeping
   the transition in one place means reduced-motion can neutralise it in one
   place too.
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
}

[data-reveal].is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* --------------------------------------------------------------------------
   6. Responsive chrome
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .chrome { padding: var(--space-5) var(--space-6); }
}

@media (max-width: 600px) {
  .chrome {
    padding: var(--space-4) var(--space-5);
    font-size: 11px;
  }

  /* `status: wip` and the email won't share a 375px row at any honest size,
     so the bottom rail stacks instead of shrinking the type. */
  .chrome--bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
}

@media (max-height: 480px) {
  .chrome { padding-block: var(--space-3); }
}

/* --------------------------------------------------------------------------
   7. Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .page__bloom { animation: none; opacity: 0.85; }

  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* The glow is the one thing that runs forever, so it is the first thing to
     go. The button keeps its hover and focus states. */
  .log-button {
    animation: none;
    box-shadow: none;
  }

  .path__seg,
  .path__sep,
  .path__link,
  .version,
  .contact__link,
  .log-button,
  .log-button__icon,
  .log-button__sweep { transition: none; }
}
