/* charliescholey.com */

:root {
  --bg: #0b1016;
  --text: #f3ede2;
  --muted: rgba(243, 237, 226, 0.66);
  --body: rgba(243, 237, 226, 0.8);
  --rule: rgba(243, 237, 226, 0.1);
  --line: rgba(243, 237, 226, 0.14);
  --card: rgba(10, 14, 22, 0.8);
  /* Highlight colour. js/flyover.js replaces these with a colour that follows the time of day;
     these are the defaults for visitors without JavaScript. */
  --accent: #8fd9a8;
  --accent-hover: #aee8c1; /* a lighter shade of the accent, for the Send button */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --display: "Faculty Glyphic", Georgia, "Times New Roman", serif; /* headings: the name, "Or send a note" */
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 11l6-6M6 5h5v5'/%3E%3C/svg%3E");
  color-scheme: dark;
  interpolate-size: allow-keywords;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
img { display: block; max-width: 100%; height: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the scene ---------- */
#sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  background: #1b2233;
  image-rendering: pixelated;
}
.no-js #sky { background: #1b2233 url("../assets/still.png") center / cover no-repeat; }

.name {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  line-height: 0.93;
  letter-spacing: -0.02em; /* Faculty Glyphic's letters touch at the -0.045em that suited Geist */
  text-shadow: 0 1px 2px rgba(6, 8, 16, 0.55), 0 2px 24px rgba(6, 8, 16, 0.65);
}

.hint {
  margin: 0;
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.66);
  color: rgba(243, 237, 226, 0.84);
  pointer-events: none;
}
.hint-touch, .hint-sky { display: none; }
@media (hover: none) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}
/* After the time-of-day button is pressed, the hint briefly names the new time (js/flyover.js). */
.hero-tools.show-sky .hint-mouse, .hero-tools.show-sky .hint-touch { display: none; }
.hero-tools.show-sky .hint-sky { display: inline; }

.hero-tools { display: flex; align-items: center; gap: 8px; }
.no-js .hero-tools { display: none; }

/* ---------- time-of-day button ---------- */
.sky-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 14, 22, 0.66);
  color: rgba(243, 237, 226, 0.84);
  cursor: pointer;
  pointer-events: auto; /* the hero itself ignores the mouse on desktop */
  touch-action: manipulation;
}
.sky-toggle[hidden] { display: none; }
.sky-toggle:hover { color: var(--accent); }
.sky-toggle svg { display: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sky-toggle[data-sky="live"] .i-live,
.sky-toggle[data-sky="sunrise"] .i-sunrise,
.sky-toggle[data-sky="midday"] .i-midday,
.sky-toggle[data-sky="golden"] .i-golden,
.sky-toggle[data-sky="dusk"] .i-dusk,
.sky-toggle[data-sky="night"] .i-night { display: block; }

/* ---------- tabs ---------- */
.tabbar { display: flex; align-items: center; }
.tabs { display: flex; align-self: stretch; align-items: center; }
[role="tab"], .ext { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; }
[role="tab"] {
  padding-top: 2px;
  border-bottom: 2px solid transparent;
  color: rgba(243, 237, 226, 0.64);
}
[role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
[role="tab"]:hover { color: var(--accent); }
.ext { margin-left: auto; }
.no-js [role="tab"] { color: var(--text); border-bottom-color: transparent; }

.pane[hidden] { display: none; }
.tabs-on .pane:not([hidden]) { animation: pane-in 260ms var(--ease) both; }
@keyframes pane-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.scroll { scrollbar-width: thin; scrollbar-color: rgba(243, 237, 226, 0.28) transparent; }

/* ---------- dropdown lists ---------- */
details { border-bottom: 1px solid var(--rule); }
details:last-child { border-bottom: 0; }
summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 16px;
  align-items: center;
  column-gap: 14px;
  min-height: 52px;
  padding: 13px 0;
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary:not(:has(.tag)) { grid-template-columns: minmax(0, 1fr) 16px; }
summary::after {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--chevron) center / 16px no-repeat;
  mask: var(--chevron) center / 16px no-repeat;
  opacity: 0.7;
  transition: transform 240ms ease;
}
details[open] > summary::after { transform: rotate(180deg); }
summary:hover .t { color: var(--accent); }
.t { font-size: 17px; line-height: 1.3; }
.tag { font-size: 13px; color: var(--muted); text-align: right; }

details::details-content {
  block-size: 0;
  overflow: hidden;
  transition: block-size 260ms var(--ease), content-visibility 260ms allow-discrete;
}
details[open]::details-content { block-size: auto; }

.more { padding-bottom: 16px; }
.more img { width: 100%; height: 196px; object-fit: cover; border-radius: 10px; margin-bottom: 12px; }
.more p { margin: 0 0 8px; font-size: 15px; line-height: 1.5; font-weight: 300; color: var(--body); }
.more p:last-child { margin-bottom: 2px; }
.more a { display: inline-block; padding: 2px 0; font-size: 14px; color: var(--accent); }
.more a:hover { color: var(--text); }

/* ---------- about ---------- */
.portrait { width: 100%; height: 186px; object-fit: cover; object-position: 50% 32%; border-radius: 10px; }
.about-text { margin: 16px 0 0; font-size: 15px; line-height: 1.55; font-weight: 300; color: var(--body); }
.about-text a { color: var(--accent); }
.about-text a:hover { color: var(--text); }
.lede { margin: 14px 0 4px; font-size: 14px; color: var(--muted); }
#pane-contact .lede { margin-top: 0; }

/* ---------- contact ---------- */
.links { list-style: none; margin: 0; padding: 0; }
.links a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 16px;
  align-items: center;
  column-gap: 14px;
  min-height: 52px;
  border-bottom: 1px solid var(--rule);
}
.links a::after {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--arrow) center / 16px no-repeat;
  mask: var(--arrow) center / 16px no-repeat;
  opacity: 0.7;
}
.links a:hover { color: var(--text); }
.links a:hover .t { color: var(--accent); }

.note { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }
.note-head h3 { margin: 0; font-family: var(--display); font-size: 17px; font-weight: 400; }
.note-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.note label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.note input, .note textarea {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(243, 237, 226, 0.16);
  border-radius: 8px;
  background: rgba(243, 237, 226, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.note textarea { height: 104px; padding: 10px 12px; resize: vertical; }
.note input:focus, .note textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.send { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.send button {
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #1c1611;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.send button:hover { background: var(--accent-hover); }
.send button:disabled { opacity: 0.6; cursor: progress; }
.form-status { margin: 0; font-size: 13px; color: var(--body); }

/* ============================================================
   Desktop: the scene fills the window, the box floats on the right
   ============================================================ */
@media (min-width: 960px) {
  :root { --box-h: max(240px, min(650px, calc(100vh - 230px))); }

  .hero { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
  .name { position: absolute; left: 56px; bottom: 60px; font-size: clamp(72px, 7.3vw, 104px); }
  .hero-tools { position: absolute; right: 56px; bottom: 56px; }
  .hint { padding: 9px 16px; font-size: 13px; }

  .panel { position: fixed; z-index: 2; top: 44px; right: 56px; width: 420px; display: flex; flex-direction: column; gap: 14px; }
  .tabbar, .box {
    background: var(--card);
    border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
  .tabbar { height: 50px; padding: 0 24px; gap: 28px; border-radius: 12px; }
  .tabs { gap: 28px; }
  [role="tab"], .ext { font-size: 15px; }
  .box { border-radius: 14px; overflow: hidden; box-shadow: 0 24px 60px rgba(4, 6, 12, 0.32); }

  .scroll {
    max-height: var(--box-h);
    overflow-y: auto;
    padding: 6px 24px 28px;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
  }
  #pane-work .scroll { height: var(--box-h); }
  #pane-about .scroll { padding: 24px 24px 36px; } /* 36px = the fade height, so the last line sits clear of it */
  #pane-contact .scroll { padding: 22px 24px 36px; } /* 36px = the fade height, so the Send button sits clear of it */

  /* Without JavaScript, all three sections stack inside one scrolling box. */
  .no-js .box { max-height: var(--box-h); overflow-y: auto; }
  .no-js .scroll { height: auto !important; max-height: none; -webkit-mask-image: none; mask-image: none; }
}

/* ============================================================
   Phones and tablets: the scene is the top of the page,
   the box becomes a sheet you scroll up over it
   ============================================================ */
@media (max-width: 959px) {
  :root { --hero-h: clamp(320px, 44svh, 480px); }

  .hero {
    position: relative;
    z-index: 1;
    height: var(--hero-h);
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
  }
  .name { position: absolute; left: max(22px, calc(50% - 308px)); bottom: 22px; font-size: clamp(52px, 15.4vw, 76px); }
  .hero-tools { position: absolute; right: max(16px, calc(50% - 304px)); top: calc(18px + env(safe-area-inset-top)); }
  .hint { padding: 7px 12px; font-size: 12px; }
  .sky-toggle { width: 40px; height: 40px; }

  .panel {
    position: relative;
    z-index: 2;
    max-width: 640px;
    min-height: calc(100svh - var(--hero-h));
    margin: 0 10px;
    background: rgba(10, 14, 22, 0.86);
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
  .tabbar {
    position: sticky;
    top: 0;
    z-index: 3;
    height: 50px;
    padding: 0 20px;
    gap: 24px;
    background: rgba(12, 16, 24, 0.96);
    border-bottom: 1px solid rgba(243, 237, 226, 0.12);
    border-radius: 18px 18px 0 0;
  }
  .tabs { gap: 24px; }
  [role="tab"], .ext { font-size: 16px; }

  .scroll { padding: 6px 20px calc(40px + env(safe-area-inset-bottom)); }
  #pane-about .scroll { padding-top: 20px; }
  #pane-contact .scroll { padding-top: 18px; }
  .more img { height: 168px; }
  .portrait { height: 160px; }
  .row { grid-template-columns: 1fr; gap: 12px; }
  .note input, .note textarea { font-size: 16px; } /* stops iOS zooming into fields */
}
@media (max-width: 374px) {
  .tabbar { padding: 0 16px; gap: 16px; }
  .tabs { gap: 16px; }
  [role="tab"], .ext { font-size: 15px; }
}
@media (min-width: 660px) and (max-width: 959px) {
  .panel { margin-inline: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .tabs-on .pane:not([hidden]) { animation: none; }
  details::details-content { transition: none; }
  summary::after { transition: none; }
}
