/* /style.css */

/* ---------- Theme ---------- */

:root {
  /* Gruvbox Dark */
  --bg: #282828;
  --bg-hard: #1d2021;
  --bg-soft: #32302f;

  --fg: #ebdbb2;
  --fg-dim: #d5c4a1;

  --yellow: #fabd2f;

  /* Hover highlight */
  --highlight-bg: #fabd2f;
  --highlight-fg: #1d2021;
  --highlight-radius: 0.45em;

  --yellow-dim: #AE8D41;
  --orange: #fe8019;
  --purple: #d3869b;
  --aqua: #8ec07c;
  --gray: #928374;
  --gray-bright: #a89984;

  /* Layout */
  --page-width: 45em;
  --page-padding: 1rem;

  /* About page photo */
  --profile-photo-size: clamp(145px, 20vw, 190px);
}


/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: "Roboto Mono", monospace;
  font-size: 1em;
  line-height: 1.45;
}

img {
  max-width: 100%;
}


/* ---------- Animation ---------- */

@keyframes intro {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}


/* ---------- Page containers ---------- */

.container {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 2rem var(--page-padding) 0 var(--page-padding);
}

[hidden] {
  display: none !important;
}

/* These animate in when visible */
.main,
.help,
footer {
  animation: intro 0.3s both;
  animation-delay: 0.15s;
}

/* IMPORTANT: do NOT put display: none here */
.help {
  /* no display rule */
}

.self-name {
  color: var(--yellow-dim);
  font-weight: bold;
}


/* ---------- Typography ---------- */

h1,
h2,
h3,
p {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 1em;
}

h1,
h3 {
  color: var(--fg);
  font-weight: normal;
}

h2 {
  color: var(--yellow);
  font-weight: normal;
}

.command,
.argument {
  color: var(--fg);
  font-weight: bold;
}

.indented {
  margin-left: 2em;
  color: var(--fg-dim);
}

.paper-entry {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}


/* ---------- Sections ---------- */

.section {
  margin-bottom: 1em;
}

.section > div {
  margin-left: 4em;
}

.section > div > * {
  margin-bottom: 0;
}


/* ---------- Links and interaction feedback ---------- */

a {
  color: var(--fg);
  font-weight: bold;
  text-decoration: none;

  padding: 0 2px;

  /*
   * Rounded fallback for browsers without corner-shape support.
   * Supporting browsers render a smoother squircle.
   */
  border-radius: var(--highlight-radius);
  corner-shape: squircle;

  /*
   * Preserve the shape and background on every line of
   * a link that wraps across multiple lines.
   */
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;

  /*
   * Remove Safari's translucent native tap bubble.
   * The custom :active state provides touch feedback.
   */
  -webkit-tap-highlight-color: transparent;

  /*
   * Treat taps as direct activation while preserving
   * normal scrolling and pinch-to-zoom.
   */
  touch-action: manipulation;

  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.photo-links {
  color: var(--fg);

  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--fg-dim);

  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}


/*
 * Keyboard focus.
 */
a:focus-visible {
  color: var(--highlight-fg);
  background-color: var(--highlight-bg);

  box-shadow:
    0 0 5px rgba(250, 189, 47, 0.72),
    0 0 13px rgba(250, 189, 47, 0.42),
    0 0 25px rgba(250, 189, 47, 0.18);

  outline: none;
}

.photo-links:focus-visible {
  text-decoration-color: var(--highlight-fg);
}


/*
 * Mouse and trackpad hover.
 */
@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--highlight-fg);
    background-color: var(--highlight-bg);

    box-shadow:
      0 0 5px rgba(250, 189, 47, 0.72),
      0 0 13px rgba(250, 189, 47, 0.42),
      0 0 25px rgba(250, 189, 47, 0.18);
  }

  .photo-links:hover {
    text-decoration-color: var(--highlight-fg);
  }
}


/*
 * Pressed state.
 *
 * This is deliberately outside a media query so it works on:
 * - phones
 * - touch-only tablets
 * - tablets connected to a mouse or trackpad
 * - desktop mouse clicks
 */
a:active {
  color: var(--highlight-fg);
  background-color: var(--highlight-bg);

  box-shadow:
    0 0 5px rgba(250, 189, 47, 0.72),
    0 0 13px rgba(250, 189, 47, 0.42),
    0 0 25px rgba(250, 189, 47, 0.18);
}

.photo-links:active {
  text-decoration-color: var(--highlight-fg);
}


/*
 * Faster feedback whenever the device has a touchscreen
 * or another coarse pointer.
 */
@media (hover: none), (pointer: coarse), (any-pointer: coarse) {
  a {
    transition:
      background-color 70ms ease,
      color 70ms ease,
      box-shadow 70ms ease;
  }
}


.back-button {
  display: inline-block;
  margin-bottom: 1em;
}


/* ---------- About page ---------- */

.about-layout {
  display: grid;
  grid-template-columns: var(--profile-photo-size) minmax(0, 1fr);
  column-gap: clamp(1rem, 4vw, 2rem);
  align-items: start;
}

.about-layout .section {
  margin-bottom: 1em;
}

.about-layout .section > div {
  margin-left: 0;
}

.photo-slot {
  color: var(--fg-dim);
  text-align: left;
  margin-bottom: 1em;
}

.profile-photo {
  display: block;
  width: var(--profile-photo-size);
  height: var(--profile-photo-size);
  margin-top: 0.5rem;
  object-fit: cover;
}

.ascii-art {
  margin: 0;
  font-family: "Roboto Mono", monospace;
  font-size: clamp(0.48rem, 1.25vw, 0.85rem);
  line-height: 1.05;
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
}

.ascii-gradient {
  display: inline-block;

  background: var(
    --ascii-gradient,
    linear-gradient(90deg, #8ec07c, #83a598, #d3869b, #fabd2f)
  );

  background-clip: text;
  -webkit-background-clip: text;

  color: transparent;
  -webkit-text-fill-color: transparent;
}


/* ---------- Text selection ---------- */

::selection {
  color: var(--highlight-fg);
  background-color: var(--highlight-bg);
}

::-moz-selection {
  color: var(--highlight-fg);
  background-color: var(--highlight-bg);
}


/* ---------- Footer ---------- */

footer {
  position: sticky;
  bottom: 0;
  z-index: 1;

  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 1px;

  background-color: var(--bg-hard);
  color: var(--fg);
  text-align: left;
}


/* ---------- Mobile ---------- */

@media (max-width: 700px) {
  :root {
    --page-padding: 1rem;
  }

  .section > div {
    margin-left: 2em;
  }

  .about-layout {
    grid-template-columns: 1fr;
    row-gap: 1rem;
  }

  .about-layout .section > div {
    margin-left: 0;
  }

  .profile-photo {
    width: min(55vw, 175px);
    height: min(55vw, 175px);
  }
}


/* ---------- Reduced motion ---------- */

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


/* ---------- Photography gallery ---------- */

.photo-gallery {
  width: 100%;
  margin-top: 1.5rem;
  padding-bottom: 2rem;
}

/*
 * Every photograph is centered and uses the same maximum width.
 * Change 34rem to make the entire gallery slightly smaller or larger.
 */
.photo-entry {
  width: min(100%, 34rem);
  margin: 0 auto 2.5rem;
}

/*
 * Normal photographs only.
 *
 * The direct-child selector prevents this rule from affecting
 * images created internally by LivePhotosKit.
 */
.photo-entry > img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  background-color: var(--bg-hard);
}

/*
 * Apple Live Photo player.
 *
 * Give the player itself a definite size, then leave all of its
 * generated children completely alone.
 */
.live-photo {
  display: block;
  position: relative;

  width: 100%;
  aspect-ratio: var(--live-photo-ratio, 3 / 4);

  margin: 0 auto;
  overflow: hidden;

  background-color: var(--bg-hard);
}


/* ---------- Photo captions ---------- */

.photo-caption {
  position: relative;

  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1rem;
  row-gap: 0.2rem;

  width: 100%;
  margin-top: 0.65rem;
  padding-top: 0.5rem;

  color: var(--fg-dim);
  font-size: 0.78rem;
  line-height: 1.4;

  border-top: 1px solid var(--bg-soft);

  transition:
    color 180ms ease,
    border-color 180ms ease;
}

/*
 * Small animated Gruvbox accent line.
 * It expands only when the photo is hovered.
 */
.photo-caption::before {
  content: "";

  position: absolute;
  top: -1px;
  left: 0;

  width: 0;
  height: 1px;

  background: linear-gradient(
    90deg,
    var(--yellow),
    #fe8019,
    #d3869b
  );

  box-shadow:
    0 0 4px rgba(250, 189, 47, 0.35),
    0 0 9px rgba(254, 128, 25, 0.18);

  transition: width 220ms ease;
}

/* Main caption: person or location */
.photo-caption-primary {
  min-width: 0;
  overflow-wrap: anywhere;

  color: var(--fg);
  font-weight: normal;

  transition:
    color 180ms ease,
    text-shadow 180ms ease;
}

/* Year */
.photo-caption-date {
  color: var(--yellow-dim);
  white-space: nowrap;
  text-align: right;

  transition:
    color 180ms ease,
    text-shadow 180ms ease;
}

/* Optional second line */
.photo-caption-secondary {
  grid-column: 1 / -1;

  color: var(--fg-dim);
  font-size: 0.72rem;

  transition:
    color 180ms ease,
    transform 180ms ease;
}


/* ---------- Back to top ---------- */

.back-to-top-row {
  width: min(100%, 34rem);
  margin: -0.5rem auto 1.5rem;
  text-align: right;
}

.back-to-top {
  display: inline-block;
}