/* Purpose: All visual styling for Codex Machina. Edit the color and spacing tokens below to make it yours. */

:root {
  color-scheme: dark;

  /* Warm dark surfaces and parchment-like text. */
  --color-background: #171a17;
  --color-surface: #20241f;
  --color-surface-raised: #252a24;
  --color-surface-inset: #191d19;
  --color-border: rgba(226, 211, 183, 0.13);
  --color-border-strong: rgba(226, 211, 183, 0.23);
  --color-text: #f1e9db;
  --color-muted: #b7b09f;
  --color-soft: #8e8b7f;
  --color-gold: #d3b27a;

  /* Font stacks have local fallbacks if Google Fonts are not available. */
  --font-serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Main page width and shared corner shape. */
  --page-width: 1240px;
  --radius-card: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--color-text);
  background:
    radial-gradient(ellipse at 12% 2%, rgba(112, 91, 65, 0.18), transparent 32rem),
    radial-gradient(ellipse at 100% 25%, rgba(82, 91, 68, 0.12), transparent 35rem),
    var(--color-background);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: 10px;
  color: var(--color-background);
  background: var(--color-gold);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(calc(100% - 64px), var(--page-width));
  margin: 0 auto;
}

/* Header: the seal and serif title give the dashboard its personal, arcane note. */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 34px;
  padding: 58px 0 42px;
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 23px;
}

.brand-seal {
  display: grid;
  width: 80px;
  height: 80px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(211, 178, 122, 0.26);
  border-radius: 23px;
  color: var(--color-gold);
  background: linear-gradient(145deg, rgba(211, 178, 122, 0.09), rgba(211, 178, 122, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 244, 222, 0.04), 0 10px 30px rgba(0, 0, 0, 0.13);
}

.brand-seal svg {
  width: 51px;
  height: 51px;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  color: var(--color-gold);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  line-height: 1.5;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin: 4px 0 1px;
  font-family: var(--font-serif);
  font-size: clamp(3.25rem, 5.1vw, 4.55rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.97;
}

.brand-copy h1 span {
  color: #d4b780;
  font-style: italic;
}

.tagline {
  margin: 9px 0 0;
  color: var(--color-muted);
  font-size: 0.91rem;
}

.clock-card {
  display: flex;
  min-width: 235px;
  align-items: flex-start;
  gap: 13px;
  padding: 16px 19px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: rgba(32, 36, 31, 0.72);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
}

.clock-ornament {
  margin-top: 2px;
  color: var(--color-gold);
  font-size: 1.05rem;
}

.clock-label,
.clock-date,
.clock-time {
  display: block;
  margin: 0;
}

.clock-label {
  color: var(--color-soft);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.clock-date {
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 0.82rem;
}

.clock-time {
  margin-top: 1px;
  color: var(--color-text);
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.015em;
}

/* Focus: a calm, low-pressure place to name today's intention. */
.focus-panel {
  display: grid;
  grid-template-columns: minmax(230px, 0.84fr) minmax(350px, 1.16fr);
  align-items: center;
  gap: 42px;
  padding: 27px 33px 25px;
  border: 1px solid rgba(211, 178, 122, 0.17);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 5% 0%, rgba(151, 113, 81, 0.14), transparent 55%),
    linear-gradient(115deg, rgba(37, 39, 32, 0.96), rgba(31, 36, 31, 0.95));
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.12);
}

.focus-intro h2,
.section-heading h2,
.notes-intro h2 {
  margin: 5px 0 2px;
  font-family: var(--font-serif);
  font-size: 2.12rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.section-copy {
  margin: 7px 0 0;
  color: var(--color-muted);
  font-size: 0.88rem;
}

.focus-input-wrap {
  position: relative;
}

.focus-glyph {
  position: absolute;
  top: 50%;
  left: 17px;
  color: var(--color-gold);
  font-family: var(--font-serif);
  font-size: 1.55rem;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-53%);
}

.focus-input-wrap input {
  width: 100%;
  height: 57px;
  padding: 0 18px 0 48px;
  border: 1px solid rgba(226, 211, 183, 0.17);
  border-radius: 12px;
  color: var(--color-text);
  background: rgba(22, 25, 22, 0.68);
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.focus-input-wrap input::placeholder {
  color: #8e8b7f;
  opacity: 1;
}

.focus-input-wrap input:focus {
  border-color: rgba(211, 178, 122, 0.58);
  background: rgba(22, 25, 22, 0.92);
  box-shadow: 0 0 0 3px rgba(211, 178, 122, 0.08);
  outline: none;
}

.field-note {
  margin: 8px 2px 0;
  color: var(--color-soft);
  font-size: 0.74rem;
  text-align: right;
}

.field-note span {
  margin-right: 3px;
  color: var(--color-gold);
}

/* Tool launcher: each card receives its own quiet accent color below. */
.tools-section {
  margin-top: 50px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading h2 {
  font-size: 2.35rem;
}

.heading-flourish {
  padding: 0 8px 5px 0;
  color: rgba(211, 178, 122, 0.62);
  font-size: 1.65rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 23px;
}

.tool-card {
  position: relative;
  display: flex;
  min-height: 188px;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  padding: 21px 22px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  color: var(--color-text);
  background: linear-gradient(145deg, rgba(38, 42, 36, 0.98), rgba(31, 35, 30, 0.98));
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.tool-card::before {
  position: absolute;
  z-index: -1;
  top: -90px;
  right: -78px;
  width: 230px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(var(--accent-rgb), 0.15), transparent 70%);
  content: "";
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 15px 34px rgba(0, 0, 0, 0.2), 0 0 28px rgba(var(--accent-rgb), 0.07);
}

.tool-card:hover::before {
  transform: scale(1.12);
}

.tool-card:active {
  transform: translateY(-1px);
}

.tool-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.26);
  border-radius: 14px;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.11);
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1;
  transition: transform 180ms ease, background-color 180ms ease;
}

.tool-card:hover .tool-icon {
  transform: rotate(-4deg) scale(1.04);
  background: rgba(var(--accent-rgb), 0.16);
}

.tool-arrow {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(226, 211, 183, 0.12);
  border-radius: 50%;
  color: var(--color-soft);
  font-size: 1rem;
  line-height: 1;
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.tool-card:hover .tool-arrow {
  transform: translate(2px, -2px);
  border-color: rgba(var(--accent-rgb), 0.42);
  color: var(--accent);
}

.tool-name {
  margin: auto 0 4px;
  padding-top: 20px;
  font-family: var(--font-serif);
  font-size: 1.48rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.12;
}

.tool-qualifier {
  color: var(--color-muted);
  font-size: 0.82em;
  font-style: italic;
}

.tool-description {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

/* Distinct accents stay within a shared, muted candlelit palette. */
.tool-card--clay {
  --accent: #dfa080;
  --accent-rgb: 223, 160, 128;
}

.tool-card--gold {
  --accent: #dfc27f;
  --accent-rgb: 223, 194, 127;
}

.tool-card--rose {
  --accent: #d99aa1;
  --accent-rgb: 217, 154, 161;
}

.tool-card--sage {
  --accent: #a8bd91;
  --accent-rgb: 168, 189, 145;
}

.tool-card--lavender {
  --accent: #c0a7cf;
  --accent-rgb: 192, 167, 207;
}

.tool-card--copper {
  --accent: #d49b6f;
  --accent-rgb: 212, 155, 111;
}

.tool-card--moss {
  --accent: #bdc68d;
  --accent-rgb: 189, 198, 141;
}

/* Notes: deliberately simple, roomy, and plain text. */
.notes-section {
  margin-top: 48px;
}

.notes-panel {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.28fr);
  align-items: start;
  gap: 42px;
  padding: 27px 30px 24px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: rgba(31, 35, 30, 0.82);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.09);
}

.notes-intro h2 {
  font-size: 2.15rem;
}

.notes-editor textarea {
  display: block;
  width: 100%;
  min-height: 174px;
  padding: 15px 16px;
  resize: vertical;
  border: 1px solid rgba(226, 211, 183, 0.15);
  border-radius: 12px;
  color: var(--color-text);
  background: rgba(22, 25, 22, 0.62);
  font-size: 0.9rem;
  line-height: 1.65;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.notes-editor textarea::placeholder {
  color: #8e8b7f;
  opacity: 1;
}

.notes-editor textarea:focus {
  border-color: rgba(211, 178, 122, 0.5);
  background: rgba(22, 25, 22, 0.86);
  box-shadow: 0 0 0 3px rgba(211, 178, 122, 0.07);
  outline: none;
}

.notes-timestamp {
  margin: 8px 2px 0;
  color: var(--color-soft);
  font-size: 0.74rem;
  text-align: right;
}

.notes-timestamp time {
  color: var(--color-muted);
}

/* Footer: understated credit plus the tiny, optional reminder. */
.site-footer {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 2px 22px;
}

.footer-credit {
  margin: 0;
  color: var(--color-soft);
  font-size: 0.76rem;
  letter-spacing: 0.025em;
}

.footer-credit span {
  margin-right: 5px;
  color: rgba(211, 178, 122, 0.75);
}

.footer-flourish {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.flourish-button {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  color: rgba(211, 178, 122, 0.62);
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.flourish-button:hover {
  transform: rotate(20deg);
  border-color: rgba(211, 178, 122, 0.23);
  color: var(--color-gold);
}

.easter-egg-note {
  max-width: 320px;
  margin: 0;
  color: var(--color-muted);
  font-family: var(--font-serif);
  font-size: 1rem;
  font-style: italic;
}

.easter-egg-note[hidden] {
  display: none;
}

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

/* Tablet and small laptop layouts. */
@media (max-width: 1080px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .page-shell {
    width: min(calc(100% - 42px), var(--page-width));
  }

  .masthead {
    align-items: flex-start;
    gap: 24px;
    padding-top: 42px;
  }

  .brand-lockup {
    gap: 17px;
  }

  .brand-seal {
    width: 68px;
    height: 68px;
    border-radius: 19px;
  }

  .brand-seal svg {
    width: 44px;
    height: 44px;
  }

  .brand-copy h1 {
    font-size: clamp(2.8rem, 6vw, 3.7rem);
  }

  .tagline {
    max-width: 410px;
    font-size: 0.85rem;
  }

  .clock-card {
    min-width: 196px;
    padding: 13px 15px;
  }

  .focus-panel {
    grid-template-columns: 1fr;
    gap: 21px;
    padding: 25px 27px 21px;
  }

  .notes-panel {
    grid-template-columns: 1fr;
    gap: 21px;
  }
}

/* Phone layout: stack the dashboard and keep every tile comfortably tappable. */
@media (max-width: 620px) {
  .page-shell {
    width: min(calc(100% - 32px), var(--page-width));
  }

  .masthead {
    flex-direction: column;
    gap: 22px;
    padding: 30px 0 29px;
  }

  .brand-lockup {
    gap: 15px;
  }

  .brand-seal {
    width: 59px;
    height: 59px;
    border-radius: 17px;
  }

  .brand-seal svg {
    width: 39px;
    height: 39px;
  }

  .eyebrow {
    font-size: 0.6rem;
    letter-spacing: 0.14em;
  }

  .brand-copy h1 {
    margin-top: 5px;
    font-size: clamp(2.55rem, 10vw, 3.45rem);
  }

  .tagline {
    max-width: 340px;
    margin-top: 6px;
    font-size: 0.8rem;
  }

  .clock-card {
    width: 100%;
    min-width: 0;
    align-items: center;
    padding: 12px 15px;
  }

  .clock-card > div {
    display: grid;
    grid-template-columns: 1fr auto;
    width: 100%;
    align-items: baseline;
    column-gap: 12px;
  }

  .clock-label {
    grid-column: 1;
  }

  .clock-date {
    grid-column: 1;
  }

  .clock-time {
    grid-column: 2;
    grid-row: 1 / span 2;
    font-size: 1.13rem;
  }

  .focus-panel {
    gap: 19px;
    padding: 22px 19px 18px;
    border-radius: 15px;
  }

  .focus-intro h2,
  .section-heading h2,
  .notes-intro h2 {
    font-size: 1.9rem;
  }

  .focus-input-wrap input {
    height: 54px;
    padding-right: 12px;
    font-size: 0.88rem;
  }

  .field-note {
    text-align: left;
  }

  .tools-section,
  .notes-section {
    margin-top: 38px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading h2 {
    font-size: 2.08rem;
  }

  .section-copy {
    max-width: 440px;
    font-size: 0.83rem;
  }

  .heading-flourish {
    padding-top: 2px;
  }

  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
  }

  .tool-card {
    min-height: 172px;
    padding: 17px 16px 16px;
    border-radius: 14px;
  }

  .tool-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .tool-name {
    padding-top: 17px;
    font-size: 1.28rem;
  }

  .tool-description {
    font-size: 0.75rem;
  }

  .notes-panel {
    gap: 17px;
    padding: 22px 19px 18px;
    border-radius: 15px;
  }

  .notes-editor textarea {
    min-height: 155px;
    font-size: 0.86rem;
  }

  .site-footer {
    min-height: 68px;
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding-top: 19px;
  }

  .footer-flourish {
    justify-content: flex-start;
  }

  .easter-egg-note {
    max-width: 280px;
    font-size: 0.96rem;
  }
}

@media (max-width: 380px) {
  .page-shell {
    width: calc(100% - 26px);
  }

  .brand-lockup {
    gap: 11px;
  }

  .brand-seal {
    width: 52px;
    height: 52px;
  }

  .brand-seal svg {
    width: 35px;
    height: 35px;
  }

  .brand-copy h1 {
    font-size: 2.44rem;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .tool-card {
    min-height: 160px;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
