/* Takora — Newsprint Design System
   "All the News That's Fit to Print."
   Light-only, sharp corners, high-contrast typography, newspaper grid.
   ─── Fonts: Playfair Display (headlines), Lora (body), Inter (UI), JetBrains Mono (data) */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,900;1,400&family=Lora:ital,wght@0,400;0,600;1,400&display=block');

:root {
  /* ── Newsprint palette ── */
  --bg: #F9F9F7;
  --fg: #111111;
  --muted: #E5E5E0;
  --accent: #CC0000;
  --border: #111111;
  --neutral-100: #F5F5F5;
  --neutral-200: #E5E5E5;
  --neutral-400: #A3A3A3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;

  /* ── Typography ── */
  --font-display: 'Playfair Display', 'Times New Roman', serif;
  --font-body: 'Lora', Georgia, serif;
  --font-sans: 'Inter', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* ── Shape ── */
  --radius: 0px;
  --shadow-hard: 4px 4px 0px 0px #111111;

  /* ── Motion ── */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --duration: 200ms;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.625;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23111111' fill-opacity='0.04' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E");
}

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--accent); }

/* ── Newsprint texture overlay ── */
.newsprint-texture { position: relative; }
.newsprint-texture::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(0deg, transparent 98%, rgba(0,0,0,0.02) 100%),
    linear-gradient(90deg, transparent 98%, rgba(0,0,0,0.02) 100%);
  background-size: 3px 3px;
  pointer-events: none; opacity: 0.5;
}

/* ── Skip link ── */
.skip-link {
  position: absolute; top: -100px; left: 16px;
  background: var(--fg); color: var(--bg);
  padding: 8px 16px; font-family: var(--font-sans); font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; z-index: 200;
}
.skip-link:focus { top: 8px; }

/* ═══ HEADER ═══ */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  border-bottom: 4px solid var(--fg);
}
.site-header .inner {
  max-width: 1280px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 24px;
  height: 56px;
}
.site-logo {
  font-family: var(--font-display);
  font-weight: 900; font-size: 20px; letter-spacing: -0.02em;
  color: var(--fg); display: flex; align-items: center; gap: 8px;
  text-transform: uppercase;
}
.site-logo .ph { font-size: 18px; }

.search-box {
  flex: 1; max-width: 400px; position: relative;
}
.search-box input {
  width: 100%; height: 40px;
  background: transparent;
  border: none; border-bottom: 2px solid var(--fg);
  padding: 0 12px 0 36px;
  color: var(--fg); font-family: var(--font-mono); font-size: 13px;
  border-radius: 0; outline: none;
  transition: background var(--duration) var(--ease);
}
.search-box input:focus { background: var(--neutral-100); }
.search-box input::placeholder { color: var(--neutral-400); }
.search-box .ph {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--neutral-400); font-size: 16px; pointer-events: none;
}

.header-links {
  display: flex; gap: 4px; margin-left: auto; align-items: center;
}
.header-links a {
  padding: 6px 14px; font-family: var(--font-sans);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--neutral-600);
  transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
}
.header-links a:hover { color: var(--accent); }

/* ═══ HERO (Landing) ═══ */
.hero {
  text-align: center; padding: 64px 16px 40px;
  max-width: 720px; margin: 0 auto;
  border-bottom: 1px solid var(--muted);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 8vw, 72px);
  font-weight: 900; letter-spacing: -0.03em;
  line-height: 0.9; margin-bottom: 16px;
}
.hero p {
  font-family: var(--font-body);
  color: var(--neutral-600); font-size: 17px; line-height: 1.6;
  max-width: 520px; margin: 0 auto 24px;
}
.hero-badges {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px;
  border: 1px solid var(--fg);
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--fg);
}

/* ═══ CATEGORIES ═══ */
.categories { max-width: 1280px; margin: 0 auto; padding: 0 16px 80px; }
.category { margin-bottom: 48px; }
.category-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 12px; margin-bottom: 16px;
  border-bottom: 4px solid var(--fg);
}
.category-head .ph { font-size: 18px; color: var(--accent); }
.category-head h2 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; letter-spacing: -0.01em;
  text-transform: uppercase;
}
.category-head .cat-count {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--neutral-500); text-transform: uppercase; letter-spacing: 0.06em;
}

/* ═══ TOOL CARDS ═══ */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0;
  border-left: 1px solid var(--fg);
}
.tool-card {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px;
  border-right: 1px solid var(--fg);
  border-bottom: 1px solid var(--fg);
  text-decoration: none; color: var(--fg);
  transition: background var(--duration) var(--ease), box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.tool-card:hover {
  background: var(--neutral-100);
  box-shadow: var(--shadow-hard);
  transform: translate(-2px, -2px);
}
.tool-card:active { transform: translate(0, 0); box-shadow: none; }

.tool-card .icon {
  flex-shrink: 0; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--fg);
  font-size: 16px;
}
.tool-card .icon:hover {
  background: var(--fg); color: var(--bg);
}
.tool-card .meta { min-width: 0; }
.tool-card .name {
  font-family: var(--font-sans); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.02em;
  line-height: 1.3; margin-bottom: 2px;
}
.tool-card .desc {
  font-family: var(--font-body); font-size: 12px;
  color: var(--neutral-600); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ═══ BREADCRUMB ═══ */
.breadcrumb {
  max-width: 960px; margin: 0 auto; padding: 12px 16px 0;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--neutral-500);
}
.breadcrumb a { color: var(--neutral-600); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: 0.3; }

/* ═══ TOOL PAGE ═══ */
.toolbar {
  max-width: 960px; margin: 0 auto; padding: 20px 16px 0;
}
.toolbar .back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-sans); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--neutral-500); margin-bottom: 12px;
}
.toolbar .back-link:hover { color: var(--accent); }
.toolbar h1 {
  font-family: var(--font-display);
  font-size: clamp(24px, 5vw, 40px);
  font-weight: 900; letter-spacing: -0.03em;
  line-height: 1; margin-bottom: 4px;
  border-bottom: 4px solid var(--fg);
  padding-bottom: 8px;
}

.tool-body {
  max-width: 960px; margin: 0 auto; padding: 16px 16px 48px;
}

/* ═══ FORM ELEMENTS ═══ */
label {
  display: block; font-family: var(--font-sans); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--neutral-600); margin-bottom: 4px;
}
input[type="text"], input[type="number"], input[type="password"],
input[type="url"], input[type="email"],
select, textarea {
  width: 100%; padding: 10px 12px;
  background: transparent;
  border: none; border-bottom: 2px solid var(--fg);
  border-radius: 0; color: var(--fg);
  font-family: var(--font-mono); font-size: 13px;
  outline: none;
  transition: background var(--duration) var(--ease);
}
input:focus, select:focus, textarea:focus { background: var(--neutral-100); }
textarea {
  min-height: 120px; resize: vertical;
  border: 1px solid var(--fg); border-bottom: 2px solid var(--fg);
}
select {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23111111' viewBox='0 0 256 256'%3E%3Cpath d='M128,184l-80-80h160Z'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.row > * { flex: 1; min-width: 0; }
.row > label { flex: 0 0 auto; }

/* ═══ BUTTONS ═══ */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px;
  font-family: var(--font-sans); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  border: 2px solid var(--fg); background: transparent;
  color: var(--fg); cursor: pointer; border-radius: 0;
  min-height: 44px; min-width: 44px;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease), box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
button:hover {
  background: var(--fg); color: var(--bg);
}
button:active { transform: translate(1px, 1px); }

button.primary {
  background: var(--fg); color: var(--bg); border-color: var(--fg);
}
button.primary:hover {
  background: var(--bg); color: var(--fg);
}

button.danger {
  border-color: var(--accent); color: var(--accent);
}
button.danger:hover {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ═══ OUTPUT ═══ */
.output {
  background: var(--neutral-100);
  border: 1px solid var(--fg);
  padding: 16px;
  font-family: var(--font-mono); font-size: 13px;
  white-space: pre-wrap; word-break: break-all;
  color: var(--fg); margin-top: 12px;
  min-height: 40px;
}

/* ═══ TABLES ═══ */
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td {
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--fg); font-size: 13px;
}
th {
  font-family: var(--font-sans); font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--neutral-600); border-bottom: 2px solid var(--fg);
}
td { font-family: var(--font-body); color: var(--fg); }

/* ═══ UTILITIES ═══ */
.muted { color: var(--neutral-500); }
.small { font-size: 12px; }
.hidden { display: none; }

/* ═══ DROPZONE ═══ */
.dropzone {
  border: 2px dashed var(--fg); padding: 32px 24px;
  text-align: center; cursor: pointer;
  font-family: var(--font-sans); font-size: 13px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--neutral-500);
  transition: background var(--duration) var(--ease);
}
.dropzone:hover { background: var(--neutral-100); }

/* ═══ IMAGE PREVIEW ═══ */
.preview-box {
  margin: 12px 0; border: 1px solid var(--fg); overflow: hidden;
}
.preview-box img { max-width: 100%; display: block; }

/* ═══ CROP RECTANGLE ═══ */
.crop-stage { position: relative; display: inline-block; max-width: 100%; }
.crop-stage img { max-width: 100%; }
.crop-box {
  position: absolute; border: 2px solid var(--bg); outline: 1px solid var(--fg);
  box-shadow: 0 0 0 9999px rgba(17, 17, 17, .55); cursor: move; touch-action: none;
}
.crop-h {
  position: absolute; width: 12px; height: 12px; margin: -7px;
  background: var(--bg); border: 2px solid var(--fg); box-sizing: border-box;
}
.crop-h[data-d="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.crop-h[data-d="n"]  { left: 50%; top: 0; cursor: ns-resize; }
.crop-h[data-d="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.crop-h[data-d="e"]  { left: 100%; top: 50%; cursor: ew-resize; }
.crop-h[data-d="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.crop-h[data-d="s"]  { left: 50%; top: 100%; cursor: ns-resize; }
.crop-h[data-d="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.crop-h[data-d="w"]  { left: 0; top: 50%; cursor: ew-resize; }

/* ═══ TOAST ═══ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--fg); color: var(--bg);
  padding: 10px 24px;
  border: 2px solid var(--fg);
  font-family: var(--font-sans); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  z-index: 100; opacity: 0; pointer-events: none;
  transition: opacity var(--duration) var(--ease);
}
.toast.show { opacity: 1; }

/* ═══ FILE LIST ═══ */
.filelist { margin: 12px 0; padding: 0; list-style: none; }
.filelist > div {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--muted);
  font-family: var(--font-mono); font-size: 13px; color: var(--neutral-600);
}

/* ═══ DIFF ═══ */
.diff-add { background: rgba(22,163,74,.1); padding: 2px 4px; }
.diff-rem { background: rgba(220,38,38,.1); padding: 2px 4px; text-decoration: line-through; }

/* ═══ ARTICLE (SEO) ═══ */
.article {
  max-width: 960px; margin: 0 auto; padding: 0 16px 32px;
}
.article p {
  font-family: var(--font-body); color: var(--neutral-600);
  font-size: 14px; line-height: 1.7; margin-bottom: 8px;
}
.article h2 {
  font-family: var(--font-display); font-size: 18px; font-weight: 700;
  color: var(--fg); margin: 24px 0 12px; padding-bottom: 8px;
  border-bottom: 2px solid var(--fg);
  text-transform: uppercase; letter-spacing: 0.02em;
}
.article h3 {
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  color: var(--fg); margin: 20px 0 10px;
}
.article ul, .article ol {
  font-family: var(--font-body); font-size: 14px; line-height: 1.7;
  color: var(--neutral-600); margin: 0 0 12px; padding-left: 24px;
}
.article li { margin-bottom: 4px; }
.article ol li::marker { font-family: var(--font-mono); color: var(--accent); font-weight: 700; }
.article strong { color: var(--fg); font-weight: 700; }
.article a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.article a:hover { color: var(--fg); }
.article code {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--neutral-100); border: 1px solid var(--neutral-200);
  padding: 1px 5px; border-radius: 2px; color: var(--fg);
}
.article table {
  width: 100%; border-collapse: collapse; margin: 12px 0 20px;
  font-family: var(--font-body); font-size: 13px;
}
.article table th {
  font-family: var(--font-sans); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  text-align: left; color: var(--fg);
  border-bottom: 2px solid var(--fg); padding: 8px 10px;
}
.article table td {
  border-bottom: 1px solid var(--neutral-200);
  padding: 8px 10px; color: var(--neutral-600); vertical-align: top;
}
.article table tr:last-child td { border-bottom: none; }
.article .related-tools { margin-top: 28px; }
.article .related-tools ul { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; }
.faq-item {
  border: 1px solid var(--fg); margin-bottom: -1px;
}
.faq-item summary {
  padding: 12px 16px; cursor: pointer;
  font-family: var(--font-sans); font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--fg); background: transparent; list-style: none;
  display: flex; align-items: center; gap: 10px;
}
.faq-item summary::before {
  content: '+'; font-family: var(--font-mono); font-weight: 400;
  font-size: 16px; color: var(--accent); width: 16px; text-align: center;
}
.faq-item[open] summary::before { content: '−'; }
.faq-item[open] summary { background: var(--neutral-100); }
.faq-item p {
  padding: 12px 16px 12px 42px;
  font-family: var(--font-body); font-size: 13px;
  color: var(--neutral-600); line-height: 1.6;
}

/* ═══ FOOTER ═══ */
.site-footer {
  max-width: 1280px; margin: 0 auto; padding: 32px 16px;
  border-top: 4px solid var(--fg);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--neutral-500);
}
.site-footer a { color: var(--neutral-600); }
.site-footer a:hover { color: var(--accent); }
.footer-links { display: flex; gap: 16px; }

/* ═══ COOKIE BANNER ═══ */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--fg); color: var(--bg);
  padding: 16px 24px; z-index: 90;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  border-top: 4px solid var(--accent);
}
.cookie-banner p {
  flex: 1; font-family: var(--font-sans); font-size: 13px; min-width: 200px;
}
.cookie-banner button {
  border-color: var(--bg); color: var(--bg);
}
.cookie-banner button:hover { background: var(--bg); color: var(--fg); }

/* ═══ ORNAMENTAL DIVIDER ═══ */
.ornament {
  text-align: center; padding: 32px 0;
  font-family: var(--font-display); font-size: 18px;
  color: var(--neutral-400); letter-spacing: 0.5em;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 640px) {
  .hero { padding: 40px 16px 24px; }
  .categories { padding: 0 16px 48px; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-grid { border-left: none; }
  .tool-card { border-right: none; }
  .toolbar, .tool-body, .breadcrumb, .article { padding-left: 16px; padding-right: 16px; }
  .row { flex-direction: column; }
  .site-header .inner { gap: 12px; }
  .header-links a:not(:last-child) { display: none; }
  .search-box { max-width: none; }
  .site-footer { flex-direction: column; text-align: center; }
  button, .btn { width: 100%; }
}

/* ═══ REDUCED MOTION ═══ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--neutral-400); }
::-webkit-scrollbar-thumb:hover { background: var(--fg); }
